Git Product home page Git Product logo

rustfulapi's Introduction

๐Ÿฆ€ RUSTfulapi

Reusable template for building REST Web Services in Rust. Uses Axum HTTP web framework and SeaORM ORM and PostgreSQL.

License Lines Of Code Format check Build Check Test Clippy Check Docker Image Test Coverage Codecov Dependency status RUSTfulapi-logo

Requirements

How to use this template

To use this template as your project starting point, click "Use this template" at the top of this page, or click here.

Feature highlights

  • Authentication. Based on jsonwebtoken
  • Layered configuration. Based on config-rs
  • Logs. Based on tracing
  • OpenAPI documentation utoipa
  • Error handling
  • Pagination
  • Profile base
  • E2E Tests
  • Postgres admin pgAdmin
  • CI based on Github actions
  • Sentry error tracking
  • Nginx as reverse proxy and secure connections with SSL certificates Nginx
  • Dependabot configuration

Running locally

./run.sh
# open swagger panel
xdg-open http://127.0.0.1:8080/swagger-ui/
# manually testing your API routes with curl commands
curl -X GET http://127.0.0.1:8080/api/v1/server/health_check

Running via docker

cd ./docker/dev/ && ./up.sh

Running tests

Some of the integration tests use Docker to spin up dependencies on demand (e.g., a postgres db),so please ensure Docker is installed before running the tests.

./test.sh

RUSTfulapi grid

Configuration

This project uses config-rs to manage configuration.

Configure with toml files

settings
โ”œโ”€โ”€ base.toml # default config file 
โ”œโ”€โ”€ dev.toml # development config file 
โ”œโ”€โ”€ prod.toml # production config file
โ””โ”€โ”€ test.toml # test config file

Configure with environment variables

export APP_SERVER__PORT=8080
export APP_SERVER__ADDR=127.0.0.1

Switching profiles

export APP_PROFILE=prod # switch to production profile

Check code formatting and typo at commit time

cp ./scripts/git-hooks/* ./.git/hooks/

Migrate database

cargo run --bin migration -- up -u $DATABASE_URL

Update ERD (Entity-Relationship Diagram) use planter

planter postgres://username:password@localhost:5432/database_name\?sslmode=disable -o docs/schema.puml

License

Licensed under either of

Contributing

Contributors are welcome! please fork and send pull requests, If you find a bug or have any ideas on how to improve this project please submit an issue.

See CONTRIBUTING.md.

rustfulapi's People

Contributors

sayyedkamran avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.