Skip to content

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.

License

Notifications You must be signed in to change notification settings

Tuntii/full-stack-rustapi-template

Basic CRUD Ops with RustAPI

License Rust

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.

🚀 Features

  • 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.

🛠️ Technology Stack

  • Framework: RustAPI
  • Database: SQLite (via sqlx)
  • Templating: Tera
  • Runtime: Tokio
  • Hashing: Argon2
  • Auth: JWT

📦 Getting Started

Prerequisites

  • Rust (latest stable)
  • sqlx-cli (optional, for running migrations manually)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/basic-crud-ops.git
    cd basic-crud-ops
  2. Setup Environment: The application defaults to sensible values, but you can create a .env file for customization:

    DATABASE_URL=sqlite:data.db?mode=rwc
    JWT_SECRET=your-secret-key
    SERVER_HOST=127.0.0.1
    SERVER_PORT=8080
  3. Run the Application:

    cargo run

    This will compile the project, run database migrations automatically, and start the server.

  4. Explore:

🏗️ Project Structure

.
├── 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

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide and Code of Conduct.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.

🙏 Acknowledgements

About

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.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published