2025-03-30 02:46:16 +07:00
2025-03-20 22:41:20 +07:00
2025-03-30 02:46:16 +07:00
2025-02-03 21:53:42 +07:00
2025-03-17 09:27:19 +07:00
2025-02-07 22:26:32 +07:00
2025-02-26 15:55:48 +07:00
2025-03-17 09:27:19 +07:00
2025-03-20 17:36:43 +07:00
2025-03-23 07:56:43 +07:00
2025-03-23 07:56:43 +07:00
2025-02-03 21:53:42 +07:00
2025-02-03 21:53:42 +07:00
2025-02-03 21:53:42 +07:00
2025-03-20 17:36:43 +07:00
2025-02-16 01:02:51 +07:00
2025-02-26 15:55:48 +07:00
2025-03-20 17:33:57 +07:00
2025-03-18 14:13:53 +07:00
2025-02-26 15:45:05 +07:00

Axum SurrealDB Boilerplate

Features

  • Authentication Ready: Preconfigured authentication and middleware for secure API access.
  • Database Integration: SurrealDB seamlessly integrated as an Axum Extension.
  • CORS Handling: Fine-tuned CORS management with Tower HTTP CorsLayer.
  • API Documentation: Fully documented with OpenAPI and Swagger UI.
  • Optimized for Performance: Asynchronous, lightweight, and scalable architecture.

Prerequisites

  • Rust: Install Rust from rust-lang.org.
  • Database: Set up a SurrealDB instance and configure connection details.
  • Docker: Required for containerized deployment, install from docker.com.
  • Nix (Optional): For reproducible builds, install from nixos.org.

Getting Started

  1. Clone the Repository:

    • git clone https://github.com/maulanasdqn/axum-surrealdb-boilerplate
  2. Set Up Environment Variables:

    • Copy .env.example and rename it to .env

    • Windows: Run the script: ./apply-env.ps1

    • Unix-based systems (Linux, macOS, BSD): Run the script: ./apply-env.sh

  3. Install Dependencies:

    • cargo install .
  4. Setup Database:

    • Install the surrealDB
    • Windows: iwr https://windows.surrealdb.com -useb | iex
    • Unix-based systems (Linux, macOS, BSD): curl -sSf https://install.surrealdb.com | sh
    • Start the database surreal start --user root --pass root
  5. Start the Server:

    • Install Cargo Watch cargo install cargo-watch
    • Run it with cargo watch cargo watch -x run

    The API will be available at http://localhost:3000/docs.

Docker

  1. Build the Docker Image:

  2. Run the Docker Container:

    The API will be accessible at http://localhost:3000/docs.

Using Nix as Builder (Optional)

  1. Install Nix:

  2. Enter Nix Shell or Use Nix Flakes:

  3. Build the Project:

  4. Run the Server:

Contributing

Contributions are welcome! Fork the repository and create a pull request with your improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

S
Description
Fork of IMPHNEN/imphnen-backend-service (mirror)
Readme
2.7 MiB
Languages
Rust 97%
Nix 2%
PowerShell 0.4%
Shell 0.4%
Dockerfile 0.2%