{"id":28496282,"url":"https://github.com/maulanasdqn/axum-sqlx-starterkit","last_synced_at":"2026-04-20T19:31:53.670Z","repository":{"id":296891280,"uuid":"994676892","full_name":"maulanasdqn/axum-sqlx-starterkit","owner":"maulanasdqn","description":"Axum SQLX Starterkit","archived":false,"fork":false,"pushed_at":"2025-07-25T08:09:03.000Z","size":69,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-10-10T22:50:41.968Z","etag":null,"topics":["postgresql","rest-api","rust","sqlx","sqlx-cli"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/maulanasdqn.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":"2025-06-02T10:05:24.000Z","updated_at":"2025-07-27T15:42:32.000Z","dependencies_parsed_at":"2025-10-10T22:49:39.512Z","dependency_job_id":"9d5c39b1-b546-4154-9e03-512e9a426735","html_url":"https://github.com/maulanasdqn/axum-sqlx-starterkit","commit_stats":null,"previous_names":["maulanasdqn/axum-sqlx-starterkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maulanasdqn/axum-sqlx-starterkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maulanasdqn%2Faxum-sqlx-starterkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maulanasdqn%2Faxum-sqlx-starterkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maulanasdqn%2Faxum-sqlx-starterkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maulanasdqn%2Faxum-sqlx-starterkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maulanasdqn","download_url":"https://codeload.github.com/maulanasdqn/axum-sqlx-starterkit/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maulanasdqn%2Faxum-sqlx-starterkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32062308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["postgresql","rest-api","rust","sqlx","sqlx-cli"],"created_at":"2025-06-08T12:07:07.298Z","updated_at":"2026-04-20T19:31:53.652Z","avatar_url":"https://github.com/maulanasdqn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Axum SQLx Starter Kit\n\nA production-ready Rust web API starter kit built with Axum and SQLx, featuring a modular architecture and comprehensive user management system.\n\n## 🚀 Features\n\n- **Modern Rust Web Framework**: Built with [Axum](https://github.com/tokio-rs/axum) for high-performance async web services\n- **Database Integration**: [SQLx](https://github.com/launchbadge/sqlx) with PostgreSQL support and compile-time checked queries\n- **Modular Architecture**: Clean separation of concerns with multiple crates\n- **User Management**: Complete authentication system with roles and permissions\n- **Database Migrations**: Automated schema management with SQLx migrations\n- **Environment Configuration**: Flexible configuration management\n- **Production Ready**: Structured for scalability and maintainability\n\n## 📁 Project Structure\n\n```\naxum-sqlx-starterkit/\n├── api-core/           # Core business logic and domain models\n├── api-entity/         # Database entities and models\n├── api-lib/            # Shared libraries and utilities\n│   └── src/sqlx/       # Database connection and configuration\n├── api-middleware/     # Custom middleware components\n├── api-migration/      # Database migration scripts\n├── .env.example        # Environment variables template\n├── .env                # Environment variables (create from .env.example)\n└── Cargo.toml          # Workspace configuration\n```\n\n## 🛠️ Prerequisites\n\n- [Rust](https://rustup.rs/) (latest stable version)\n- [PostgreSQL](https://www.postgresql.org/) (version 12 or higher)\n- [SQLx CLI](https://github.com/launchbadge/sqlx/tree/master/sqlx-cli) for migrations\n\n## 📦 Installation\n\n1. **Clone the repository**\n\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd axum-sqlx-starterkit\n   ```\n\n2. **Install SQLx CLI**\n\n   ```bash\n   cargo install sqlx-cli --no-default-features --features postgres\n   ```\n\n3. **Set up environment variables**\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Edit `.env` with your database configuration:\n\n   ```env\n   DATABASE_URL=postgresql://username:password@localhost/axum_sqlx_starterkit_db\n   ```\n\n4. **Create and setup database**\n\n   ```bash\n   # Create database\n   sqlx database create\n\n   # Run migrations\n   sqlx migrate run --source api-migration/src\n   ```\n\n5. **Build the project**\n   ```bash\n   cargo build\n   ```\n\n## 🚀 Running the Application\n\n```bash\ncargo run\n```\n\nThe API will be available at `http://localhost:3000` (or your configured port).\n\n## 🗄️ Database Schema\n\nThe starter kit includes a comprehensive user management system:\n\n### Tables\n\n- **`app_users`**: User accounts with authentication details\n- **`app_roles`**: Role definitions for authorization\n- **`app_permissions`**: Granular permission system\n- **`app_role_permissions`**: Many-to-many relationship between roles and permissions\n\n### Key Features\n\n- UUID primary keys for all tables\n- Automatic timestamp tracking (`created_at`, `updated_at`)\n- Foreign key constraints for data integrity\n- Unique constraints on email and phone numbers\n\n## 🔧 Development\n\n### Running Migrations\n\n```bash\n# Create a new migration\nsqlx migrate add --source api-migration/src \u003cmigration_name\u003e\n\n# Run pending migrations\nsqlx migrate run --source api-migration/src\n\n# Revert last migration\nsqlx migrate revert --source api-migration/src\n```\n\n### Environment Setup\n\nUse the provided PowerShell script to apply environment variables:\n\n```powershell\n.\\apply-env.ps1\n```\n\n### Code Organization\n\n- **`api-core/`**: Contains core business logic, use cases, and domain models\n- **`api-entity/`**: Database entity definitions and data models\n- **`api-lib/`**: Shared utilities, database connections, and common functionality\n- **`api-middleware/`**: Custom Axum middleware for authentication, logging, etc.\n- **`api-migration/`**: All database migration files\n\n## 🧪 Testing\n\n```bash\n# Run all tests\ncargo test\n\n# Run tests for a specific crate\ncargo test -p api-core\n```\n\n## 📝 API Documentation\n\nThe API follows RESTful conventions. Key endpoints include:\n\n- `POST /auth/login` - User authentication\n- `POST /auth/register` - User registration\n- `GET /users` - List users (with pagination)\n- `PUT /users/{id}` - Update user information\n- `GET /roles` - List available roles\n- `GET /permissions` - List available permissions\n\n## 🔒 Security Features\n\n- Password hashing and validation\n- Role-based access control (RBAC)\n- JWT token authentication (when implemented)\n- SQL injection prevention through SQLx\n- Input validation and sanitization\n\n## 🚀 Deployment\n\n### Docker (Recommended)\n\n```dockerfile\n# Example Dockerfile structure\nFROM rust:1.70 as builder\nWORKDIR /app\nCOPY . .\nRUN cargo build --release\n\nFROM debian:bookworm-slim\nRUN apt-get update \u0026\u0026 apt-get install -y ca-certificates\nCOPY --from=builder /app/target/release/axum-sqlx-starterkit /usr/local/bin/\nCMD [\"axum-sqlx-starterkit\"]\n```\n\n### Environment Variables\n\nEnsure these environment variables are set in production:\n\n```env\nDATABASE_URL=postgresql://user:pass@host:port/database\nRUST_LOG=info\nPORT=3000\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open 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- [Axum](https://github.com/tokio-rs/axum) - Modern async web framework\n- [SQLx](https://github.com/launchbadge/sqlx) - Async SQL toolkit\n- [Tokio](https://tokio.rs/) - Async runtime for Rust\n- [Serde](https://serde.rs/) - Serialization framework\n\n## 📞 Support\n\nIf you have any questions or need help, please:\n\n1. Check the [documentation](docs/)\n2. Search existing [issues](issues/)\n3. Create a new [issue](issues/new) if needed\n\n---\n\n**Happy coding! 🦀**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaulanasdqn%2Faxum-sqlx-starterkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaulanasdqn%2Faxum-sqlx-starterkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaulanasdqn%2Faxum-sqlx-starterkit/lists"}