{"id":48147717,"url":"https://github.com/kavinda-100/rust-vehicle-api","last_synced_at":"2026-04-04T17:01:53.669Z","repository":{"id":308000229,"uuid":"1031321918","full_name":"kavinda-100/rust-vehicle-api","owner":"kavinda-100","description":"A modern, high-performance RESTful API built with Rust for vehicle management systems. ","archived":false,"fork":false,"pushed_at":"2025-08-03T15:20:54.000Z","size":31284,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T15:31:46.367Z","etag":null,"topics":["api","axum","postgresql","rest-api","rust","sea-orm"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kavinda-100.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-08-03T13:54:19.000Z","updated_at":"2025-08-03T15:23:47.000Z","dependencies_parsed_at":"2025-08-03T15:41:57.167Z","dependency_job_id":null,"html_url":"https://github.com/kavinda-100/rust-vehicle-api","commit_stats":null,"previous_names":["kavinda-100/rust-vehicle-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/kavinda-100/rust-vehicle-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavinda-100%2Frust-vehicle-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavinda-100%2Frust-vehicle-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavinda-100%2Frust-vehicle-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavinda-100%2Frust-vehicle-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kavinda-100","download_url":"https://codeload.github.com/kavinda-100/rust-vehicle-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavinda-100%2Frust-vehicle-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31407391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","axum","postgresql","rest-api","rust","sea-orm"],"created_at":"2026-04-04T17:01:53.313Z","updated_at":"2026-04-04T17:01:53.590Z","avatar_url":"https://github.com/kavinda-100.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚗 Rust Vehicle API\n\nA high-performance RESTful API for vehicle management built with modern Rust technologies.\n\n## 🛠️ Tech Stack\n\n- **🦀 Rust** - Systems programming language\n- **⚡ Axum** - Fast and ergonomic web framework\n- **🌊 SeaORM** - Async \u0026 dynamic ORM for Rust\n- **🐘 PostgreSQL** - Robust relational database\n- **🔐 JWT** - JSON Web Tokens for authentication\n- **📦 Tokio** - Async runtime for Rust\n\n## 🚀 Features\n\n- ✅ User authentication and authorization\n- ✅ JWT-based security\n- ✅ RESTful API endpoints\n- ✅ Database migrations\n- ✅ CORS support\n- ✅ Error handling middleware\n- ✅ UUID primary keys\n- ✅ Async/await throughout\n\n## 🏗️ Project Structure\n\n```\nrust-vehicle-api/\n├── 📁 src/\n│   ├── 🎯 main.rs              # Application entry point\n│   ├── 📁 controllers/         # Request handlers\n│   ├── 📁 middlewares/         # Auth \u0026 other middleware\n│   ├── 📁 models/              # Data models\n│   ├── 📁 routes/              # Route definitions\n│   └── 📁 utils/               # Utilities (JWT, errors)\n├── 📁 entity/                  # SeaORM entities\n├── 📁 migration/               # Database migrations\n├── 📄 Cargo.toml              # Rust dependencies\n└── 📄 .env                    # Environment variables\n```\n\n## 🔧 Setup \u0026 Installation\n\n### Prerequisites\n\n- Rust (latest stable version)\n- PostgreSQL\n- Sea-ORM CLI\n\n### 1. Clone the repository\n\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd rust-vehicle-api\n```\n\n### 2. Install dependencies\n\n```bash\ncargo build\n```\n\n### 3. Install SeaORM CLI\n\n```bash\ncargo install sea-orm-cli\n```\n\n### 4. Setup database\n\nCreate a PostgreSQL database and update your `.env` file:\n\n```env\nDATABASE_URL=postgres://username:password@localhost:5432/rust_vehicle_api\nJWT_SECRET=your-super-secure-secret-key-here\nJWT_EXPIRATION=86400\nSERVER_HOST=0.0.0.0\nSERVER_PORT=5000\n```\n\n### 5. Run migrations\n\n```bash\nsea-orm-cli migrate fresh\n```\n\n### 6. Start the server\n\n```bash\ncargo run\n```\n\nThe API will be available at `http://localhost:5000`\n\n## 📡 API Endpoints\n\n### Authentication\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| POST | `/auth/register` | Register a new user |\n| POST | `/auth/login` | Login user |\n\n### Users\n\n| Method | Endpoint | Description | Auth Required |\n|--------|----------|-------------|---------------|\n| GET | `/users` | Get all users | ✅ |\n| GET | `/users/:id` | Get user by ID | ✅ |\n| PUT | `/users/:id` | Update user | ✅ |\n| DELETE | `/users/:id` | Delete user | ✅ |\n\n### Health Check\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| GET | `/` | API status |\n| GET | `/test` | Test endpoint |\n\n## 🔐 Authentication\n\nThis API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:\n\n```\nAuthorization: Bearer \u003cyour-jwt-token\u003e\n```\n\n## 🗃️ Database Schema\n\n### Users Table\n\n| Column | Type | Constraints |\n|--------|------|-------------|\n| id | UUID | Primary Key, Default: gen_random_uuid() |\n| name | VARCHAR | NOT NULL |\n| email | VARCHAR | UNIQUE, NOT NULL |\n| created_at | TIMESTAMPTZ | NOT NULL, Default: CURRENT_TIMESTAMP |\n| updated_at | TIMESTAMPTZ | NOT NULL, Default: CURRENT_TIMESTAMP |\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n1. **UUID Auto-increment Error**\n   ```\n   not implemented: Uuid doesn't support auto increment\n   ```\n   **Solution**: Use `gen_random_uuid()` as default value instead of auto-increment.\n\n2. **Database Authentication Failed**\n   ```\n   password authentication failed for user \"username\"\n   ```\n   **Solution**: Update DATABASE_URL in `.env` with correct credentials.\n\n3. **Migration Issues**\n   ```bash\n   # Reset migrations\n   sea-orm-cli migrate fresh\n   \n   # Check migration status\n   sea-orm-cli migrate status\n   ```\n\n## 🔨 Development\n\n### Generate new migration\n\n```bash\nsea-orm-cli migrate generate create_vehicles_table\n```\n\n### Generate entities from database\n\n```bash\nsea-orm-cli generate entity -o entity/src\n```\n\n### Run tests\n\n```bash\ncargo test\n```\n\n### Format code\n\n```bash\ncargo fmt\n```\n\n### Lint code\n\n```bash\ncargo clippy\n```\n\n## 📝 Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `DATABASE_URL` | PostgreSQL connection string | Required |\n| `JWT_SECRET` | Secret key for JWT tokens | Required |\n| `JWT_EXPIRATION` | Token expiration time (seconds) | 86400 |\n| `SERVER_HOST` | Server bind address | 0.0.0.0 |\n| `SERVER_PORT` | Server port | 5000 |\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- Built with ❤️ using Rust\n- Powered by the amazing Rust ecosystem\n- SeaORM for making database operations enjoyable\n- Axum for the fantastic web framework\n\n---\n\n⭐ **Star this repo if you find it helpful!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavinda-100%2Frust-vehicle-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavinda-100%2Frust-vehicle-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavinda-100%2Frust-vehicle-api/lists"}