Skip to content

A simple API service with a high-performance, type-safe, and memory-safe Feature Flag Management System built with Rust. It provides a robust API for creating, updating, and managing feature flags in your applications, leveraging the power and safety of Rust.

Notifications You must be signed in to change notification settings

benborla/rust-microservice-starter-kit

Repository files navigation

🦀 Rust Microservice Starter Kit

Status GitHub Issues GitHub Pull Requests License


A high-performance, type-safe, and memory-safe microservice starter kit built with Rust. This starter kit provides a robust foundation for building efficient APIs, leveraging the power and safety of Rust along with the Axum web framework and Neon for serverless PostgreSQL database interactions.

📝 Table of Contents

🧐 About

This Rust Microservice Starter Kit provides a solid foundation for building high-performance, type-safe, and memory-safe microservices. It harnesses the power of Rust along with modern frameworks and tools to ensure robust and efficient API development.

Visit Demo: https://rust-microservice-starter-kit.fly.dev/

Key Features

  • Rust: A language empowering everyone to build reliable and efficient software.
  • Axum: A modular web framework built with Tokio, Tower, and Hyper.
  • Neon: 🚀 Supercharge your development with Neon's serverless PostgreSQL! Enjoy lightning-fast performance, effortless scaling, and a generous free tier. Say goodbye to database management hassles and hello to the future of PostgreSQL! 🌟
  • High Performance: Optimized for speed and efficiency.
  • Type Safety: Leveraging Rust's strong type system to prevent runtime errors.
  • Memory Safety: Rust's ownership model ensures memory safety without garbage collection.

🏁 Getting Started

Prerequisites

  1. Rust (latest stable version)

  2. SeaORM CLI Open a terminal and run:

    cargo install sea-orm-cli
    
  3. Neon PostgreSQL 🎉 Elevate your database game with Neon! 🚀 Experience the power of serverless, autoscaling PostgreSQL in the cloud. Zero management, instant setup, and a generous free tier to get you started. Unleash the full potential of your applications with Neon's unrivaled performance and flexibility. Try Neon now and witness the revolution in PostgreSQL hosting! ⚡️💪

    To get started with Neon:

    • Visit https://neon.tech
    • Sign up for an account
    • Create a new project to get your database credentials

    Alternatively, if you prefer local hosting:

    PostgreSQL (local installation)

Installation

  1. Clone the repository

    git clone https://github.com/benborla/rust-microservice-starter-kit.git
    cd rust-microservice-starter-kit
    
  2. Install dependencies

    cargo build
    cd migration && cargo build
    
  3. Set up the database

    # Create .env file 
    cp .env.dist .env
    # Edit your .env and replace the value of DATABASE_URL,
    # it should be a POSTGRESQL Connection String from your Neon database or your local PostgreSQL server.
    
    # Run migrations
    cd migration
    cargo run -- up  
    
  4. Run the application

    cd ..
    cargo run
    

The server should now be running on http://localhost:3000.

🏗️ Project Structure

./rust-microservice-starter-kit
├── src
│   ├── api
│   │   ├── handlers
│   │   ├── mod.rs
│   │   └── routes.rs
│   ├── config.rs  
│   ├── db
│   │   └── mod.rs
│   ├── error.rs
│   ├── lib.rs
│   ├── main.rs
│   ├── models  
│   │   ├── mod.rs
│   │   └── prelude.rs
│   └── services
│       └── mod.rs
├── migration
│   └── src 
│       └── ...
├── tests
│   ├── api_tests.rs
│   └── common
│       └── mod.rs
├── ...

🔧 Running Tests

You can find the test files in the ./tests directory. Note: A sample unit test is available. To run the tests, use:

cargo test

🚀 Deployment

You can deploy this project using Fly.io.

🛠️ Built With

  • Rust - Programming Language
  • Axum - Web Framework
  • Tokio - Asynchronous Runtime
  • SeaORM - ORM and Query Builder
  • SeaORM CLI - Official SeaORM CLI tool
  • PostgreSQL - Database
  • Neon - 🌟 Serverless PostgreSQL for the modern developer 🚀

✍️ Authors

About

A simple API service with a high-performance, type-safe, and memory-safe Feature Flag Management System built with Rust. It provides a robust API for creating, updating, and managing feature flags in your applications, leveraging the power and safety of Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published