diff --git a/README.md b/README.md index e0833a8..1edb045 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ - - -
# 🦀 Rust Microservice Starter Kit @@ -13,110 +10,64 @@ --- -

A high-performance, type-safe, and memory-safe Microservice built with Rust. This starter kit provides a robust API, leveraging the power and safety of Rust along with the Axum web framework and Neon for PostgreSQL database interactions. -
+

+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](#about) -- [Getting Started](#getting_started) + - [Key Features](#key-features) +- [Getting Started](#getting-started) + - [Prerequisites](#prerequisites) + - [Installation](#installation) +- [Project Structure](#project-structure) +- [Running Tests](#running-tests) - [Deployment](#deployment) -- [Built Using](#built_using) +- [Built With](#built-with) - [Authors](#authors) -## 🧐 About -This Rust Microservice Starter Kit is designed to provide a solid foundation for building high-performance, type-safe, and memory-safe microservices. It leverages the power of Rust along with modern frameworks and tools to ensure robust and efficient API development. +## 🧐 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: +### Key Features - **Rust**: A language empowering everyone to build reliable and efficient software. -- **Axum**: A modular web framework that's built with Tokio, Tower, and Hyper. -- **Neon**: Serverless Postgres with a generous free tier. Neon separates storage and compute to offer autoscaling, branching, and bottomless storage. +- **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 - -### Project Structure -``` -./rust-microservice-starter-kit -├── Cargo.lock -├── Cargo.toml -├── Dockerfile -├── README.md -├── docs -│   └── API.md -├── fly.toml -├── migration -│   ├── Cargo.lock -│   ├── Cargo.toml -│   ├── README.md -│   └── src -│   ├── lib.rs -│   ├── m20240828_134140_create_feature_flag_table.rs -│   ├── m20240828_140244_seed_feature_flag_with_sample_data.rs -│   └── main.rs -├── src -│   ├── api -│   │   ├── handlers -│   │   │   ├── feature_flags.rs -│   │   │   ├── health_check.rs -│   │   │   └── mod.rs -│   │   ├── mod.rs -│   │   └── routes.rs -│   ├── config.rs -│   ├── db -│   │   └── mod.rs -│   ├── error.rs -│   ├── lib.rs -│   ├── main.rs -│   ├── models -│   │   ├── feature_flags.rs -│   │   ├── mod.rs -│   │   └── prelude.rs -│   └── services -│   ├── feature_flag_service.rs -│   └── mod.rs -└── tests - ├── api_tests.rs - └── common - ├── feature_flag_mock.rs - └── mod.rs -``` +## 🏁 Getting Started -These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. +### Prerequisites -### Prerequisites +1. **Rust (latest stable version)** + - Visit https://www.rust-lang.org/tools/install + - Follow the instructions for your operating system -**1.** Rust (latest stable version) -- Visit https://www.rust-lang.org/tools/install -- Follow the instructions for your operating system - -**2.** SeaORM CLI -Open a terminal and run: -``` -cargo install sea-orm-cli -``` - - **3.** Neon PostgreSQL
-Turbocharge your database with Neon! ⚡️ Serverless, autoscaling PostgreSQL in the cloud. Zero management, instant setup. Try Neon now and supercharge your app's performance! - -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: +2. **SeaORM CLI** + Open a terminal and run: + ``` + cargo install sea-orm-cli + ``` -**PostgreSQL** (local installation) -- Download from https://www.postgresql.org/download/ -- Follow the installation guide for your operating system +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 -### Installing + Alternatively, if you prefer local hosting: + + **PostgreSQL (local installation)** + - Download from https://www.postgresql.org/download/ + - Follow the installation guide for your operating system -A step by step series of examples that tell you how to get a development env running. +### Installation 1. Clone the repository ``` @@ -126,43 +77,81 @@ A step by step series of examples that tell you how to get a development env run 2. Install dependencies ``` - cargo build; cd migration; cargo build + cargo build + cd migration && cargo build ``` 3. Set up the database ``` - # Create.env file via + # Create .env file cp .env.dist .env - + # Run migrations cd migration - cargo run -- up + cargo run -- up ``` -4. Go back to the project, then run the application +4. Run the application ``` + cd .. cargo run ``` The server should now be running on `http://localhost:3380`. -## 🔧 Running the tests -You may find the tests files in `./tests` -Note: There's a sample Unit Test available, you may run it using +## 🏗️ 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 may deploy this using [FlyIO](https://fly.io/). -## ⛏️ Built Using +## 🚀 Deployment + +You can deploy this project using [Fly.io](https://fly.io/). + +## 🛠️ Built With + - [Rust](https://www.rust-lang.org/) - Programming Language -- [Axum](https://github.com/tokio-rs/axum) - Web Framework +- [Axum](https://github.com/tokio-rs/axum) - Web Framework - [Tokio](https://tokio.rs/) - Asynchronous Runtime - [SeaORM](https://www.sea-ql.org/SeaORM/) - ORM and Query Builder - [SeaORM CLI](https://www.sea-ql.org/SeaORM/docs/generate-entity/sea-orm-cli/) - Official SeaORM CLI tool -- [Postgres](https://www.postgresql.org/) - Database -- [Neon](https://neon.tech/) - Serverless Postgres for modern developers +- [PostgreSQL](https://www.postgresql.org/) - Database +- [Neon](https://neon.tech/) - 🌟 Serverless PostgreSQL for the modern developer 🚀 + +## ✍️ Authors -## ✍️ Authors - [@benborla](https://github.com/benborla) - Idea & Initial work