A complete, full-stack reference implementation of a generic CRUD application using RustAPI.
This project demonstrates how to build production-ready web applications with RustAPI, featuring server-side rendering, JWT authentication, SQLite database integration, and automated OpenAPI documentation.
- Full-Stack Implementation: Server-side rendering with Tera templates.
- Modern Architecture: Built on RustAPI for high performance and developer ergonomics.
- Automated OpenAPI: Zero-config Swagger UI documentation at
/docs. - Database Integration: Async SQLite usage with sqlx.
- Authentication: Secure user management with Argon2 hashing and JWT sessions.
- Validation: Declarative request validation.
- Framework: RustAPI
- Database: SQLite (via
sqlx) - Templating: Tera
- Runtime: Tokio
- Hashing: Argon2
- Auth: JWT
- Rust (latest stable)
sqlx-cli(optional, for running migrations manually)
-
Clone the repository:
git clone https://github.com/yourusername/basic-crud-ops.git cd basic-crud-ops -
Setup Environment: The application defaults to sensible values, but you can create a
.envfile for customization:DATABASE_URL=sqlite:data.db?mode=rwc JWT_SECRET=your-secret-key SERVER_HOST=127.0.0.1 SERVER_PORT=8080
-
Run the Application:
cargo run
This will compile the project, run database migrations automatically, and start the server.
-
Explore:
- Web Interface: http://127.0.0.1:8080
- API Documentation: http://127.0.0.1:8080/docs
.
├── src/
│ ├── handlers/ # API and View handlers
│ ├── models/ # Database structs and Domain types
│ ├── db.rs # Database connection and setup
│ ├── main.rs # Application entry point and state
│ └── ...
├── templates/ # HTML templates (Tera)
├── static/ # Static assets (CSS, JS)
└── migrations/ # SQLx database migrations
Contributions are welcome! Please read our Contributing Guide and Code of Conduct.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
- Built with RustAPI.