Skip to content

A boilerplate with Bun, Elysia, Drizzle ORM, Postgres,...

License

Notifications You must be signed in to change notification settings

nguyenvanvy1999/elysia

Repository files navigation

Elysia with Bun runtime

Linter

Unit test

Description

A backend project, build with Elysia, Bun. Another technology is:

  • Drizzle ORM
  • DB: PostgreSQL
  • Cache: Redis
  • Message Queue: Kafka
  • SMS: Twilio
  • Email sender: Sendgrid

Feature of project:

  • Auth: Signup, sign in, JWT, RBAC, encrypt token, session control for deleted/inactive/block user, multiple device sessions management.
  • User: Get user profile, Admin CRUD users.
  • Setting: Admin CRUD settings, cache some useful setting, reload server after change setting.
  • Translation: Admin CRUD translations, i18n for response message, i18n load for Frontend.
  • Other: logger, swagger UI, graceful shutdown, env validate and parser, seed data, maintenance status.

Todo:

  • gRPC implements
  • GraphQL implements
  • DB debugger (write debug logs on DB)
  • Add more detail about device: Last active, Last location, IP address, Login method, Login time

Getting Started

To run this project local, first let this command to start docker compose:

cp ./docker/local/.env.example ./docker/local/.env

This command will create env file include redis, postgrest and kafka username and password. You can change it with your password.

After that, let create .env file for app with this command: You can change these env configs with your configs

cp .env.example .env

Start the docker compose file

sudo docker compose -f docker/local/docker-compose.yml up -d

And now, let run migrate and seed data command

bun run db:migrate && bun run db:seed

End, start server local:

bun run dev

Open http://localhost:3000/ with your browser to see the result.

Swagger UI available default at: http://localhost:3000/swagger