{"id":51297728,"url":"https://github.com/nobokumar/spotsync-server","last_synced_at":"2026-06-30T16:01:45.496Z","repository":{"id":367405398,"uuid":"1280659005","full_name":"noboKumar/SpotSync-server","owner":"noboKumar","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-25T21:09:11.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-25T22:12:41.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noboKumar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-25T20:08:37.000Z","updated_at":"2026-06-25T21:09:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/noboKumar/SpotSync-server","commit_stats":null,"previous_names":["nobokumar/spotsync-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/noboKumar/SpotSync-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noboKumar%2FSpotSync-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noboKumar%2FSpotSync-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noboKumar%2FSpotSync-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noboKumar%2FSpotSync-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noboKumar","download_url":"https://codeload.github.com/noboKumar/SpotSync-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noboKumar%2FSpotSync-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34973617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-30T16:01:44.005Z","updated_at":"2026-06-30T16:01:45.474Z","avatar_url":"https://github.com/noboKumar.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚗 SpotSync API\n\nSmart Parking \u0026 EV Charging Reservation System built with Go, Echo, GORM, PostgreSQL, and JWT authentication.\n\n## 🌍 Live Demo\n\n* **Backend API:** https://spotsync-server-285t.onrender.com\n---\n\n## 📌 Project Overview\n\nSpotSync is a centralized parking management platform designed for busy airports and malls. The system supports regular parking and EV charging reservations while ensuring that parking zones never exceed their capacity, even under concurrent booking requests.\n\nThe project implements Clean Architecture principles and uses database transactions with row-level locking (`FOR UPDATE`) to prevent race conditions during reservations.\n\n---\n\n## ✨ Features\n\n### 🔐 Authentication\n\n* User registration\n* User login\n* JWT authentication\n* Password hashing with bcrypt\n* Role-based authorization\n\n### 🚗 Parking Zones\n\n* Create parking zones (Admin)\n* View all parking zones\n* View single parking zone\n* Dynamic available spot calculation\n\n### 📅 Reservations\n\n* Reserve parking spots\n* View personal reservations\n* Cancel reservations\n* View all reservations (Admin)\n* Concurrency-safe booking system using transactions and row locking\n\n---\n\n## 🛠 Tech Stack\n\n| Technology | Usage              |\n| ---------- | ------------------ |\n| Go 1.24+   | Backend language   |\n| Echo       | HTTP framework     |\n| GORM       | ORM                |\n| PostgreSQL | Database           |\n| JWT        | Authentication     |\n| bcrypt     | Password hashing   |\n| Validator  | Request validation |\n\n---\n\n## 🏗 Domain Driven Design\n\nThe project follows Domain Driven Design principles:\n\n```text\nSpotSync-server/\n│\n├── cmd/\n│   └── main.go\n│\n├── auth/\n│   └── jwt.go\n│\n├── config/\n│   └── config.go\n│\n├── database/\n│   └── postgres.go\n│\n├── domain/\n│   │\n│   ├── users/\n│   │   ├── dto/\n│   │   │   ├── request.go\n│   │   │   └── response.go\n│   │   ├── entity.go          # User model\n│   │   ├── repository.go\n│   │   ├── service.go\n│   │   ├── handler.go\n│   │   └── routes.go\n│   │\n│   ├── parking_zones/\n│   │   ├── dto/\n│   │   │   ├── request.go\n│   │   │   └── response.go\n│   │   ├── entity.go          # ParkingZone model\n│   │   ├── repository.go\n│   │   ├── service.go\n│   │   ├── handler.go\n│   │   └── routes.go\n│   │\n│   └── reservations/\n│       ├── dto/\n│       │   ├── request.go\n│       │   └── response.go\n│       ├── entity.go          # Reservation model\n│       ├── repository.go\n│       ├── service.go\n│       ├── handler.go\n│       └── routes.go\n│\n├── middleware/\n│   ├── auth.go\n│   └── admin.go\n│\n├── server/\n│   └── http.go\n│\n├── utils/\n│   ├── error.go\n│   └── parse.go\n│\n├── .env\n├── .gitignore\n├── go.mod\n├── go.sum\n└── README.md\n```\n\n### Layer Responsibilities\n\n| Layer      | Responsibility                  |\n| ---------- | ------------------------------- |\n| DTO        | Request and response structures |\n| Handler    | HTTP request handling           |\n| Service    | Business logic                  |\n| Repository | Database operations             |\n| Models     | Database entities               |\n\nDependencies flow in one direction:\n\n```text\nHandler\n   ↓\nService\n   ↓\nRepository\n   ↓\nDatabase\n```\n\n---\n\n## 🔒 Concurrency Handling\n\nThe reservation system prevents overbooking by using:\n\n* Database Transactions\n* Row-Level Locking (`FOR UPDATE`)\n* Atomic reservation creation\n\nThis guarantees that two users cannot reserve the last available spot simultaneously.\n\nExample:\n\n```go\ntx.Clauses(\n    clause.Locking{\n        Strength: \"UPDATE\",\n    },\n).First(\u0026zone, zoneID)\n```\n\n---\n\n## ⚙️ Environment Variables\n\nCreate a `.env` file:\n\n```env\nDSN=dataBase_connection\nPORT=8080\nJWT_SECRET=your-super-secret-key\n```\n---\n\n## 🚀 Running Locally\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/noboKumar/SpotSync-server.git\n\ncd SpotSync-server\n```\n\n### 2. Install Dependencies\n\n```bash\ngo mod tidy\n```\n\n### 3. Create Environment Variables\n\n```bash\ncp .env\n```\n\nUpdate the values inside `.env`.\n\n### 5. Run the Application\n\n```bash\ngo run cmd/main.go\n```\n\nor\n\n```bash\ngo run main.go\n```\n\ndepending on your project structure.\n\nThe server will start at:\n\n```text\nhttp://localhost:8080\n```\n\n---\n\n## 🔥 Development Mode (Hot Reload)\n\nInstall Air:\n\n```bash\ngo install github.com/air-verse/air@latest\n```\n\nRun:\n\n```bash\nair\n```\n\n---\n\n## 📚 API Endpoints\n\n### Authentication\n\n| Method | Endpoint                | Access |\n| ------ | ----------------------- | ------ |\n| POST   | `/api/v1/auth/register` | Public |\n| POST   | `/api/v1/auth/login`    | Public |\n\n---\n\n### Parking Zones\n\n| Method | Endpoint            | Access |\n| ------ | ------------------- | ------ |\n| POST   | `/api/v1/zones`     | Admin  |\n| GET    | `/api/v1/zones`     | Public |\n| GET    | `/api/v1/zones/:id` | Public |\n\n---\n\n### Reservations\n\n| Method | Endpoint                               | Access        |\n| ------ | -------------------------------------- | ------------- |\n| POST   | `/api/v1/reservations`                 | Authenticated |\n| GET    | `/api/v1/reservations/my-reservations` | Authenticated |\n| DELETE | `/api/v1/reservations/:id`             | Authenticated |\n| GET    | `/api/v1/reservations`                 | Admin         |\n\n---\n\n## 🧪 Testing API\n\nYou can test the API using:\n\n* Postman\n* Thunder Client\n* Insomnia\n* cURL\n\nExample:\n\n```bash\ncurl http://localhost:8080/api/v1/zones\n```\n\n---\n\n## 📜 License\n\nThis project was developed as part of an academic assignment and is intended for educational purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnobokumar%2Fspotsync-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnobokumar%2Fspotsync-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnobokumar%2Fspotsync-server/lists"}