Giter Site home page Giter Site logo

hrishix6 / backend-template-2024 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 52 KB

backend template.

License: MIT License

TypeScript 100.00%
backend-api backend-template express express-docker express-typescript-boilerplate express-typescript-starter typescript

backend-template-2024's Introduction

Opinionated backend project template

This is opinionated project template for backend in 2024.

Base

Libraries

  • zod - validations.
  • typedi - depedency injection tool.
  • dotenv - config loader in development.
  • kysely - query builder for postgres.
  • winston - logger.

Code quality & formatting

Other integrations

Setup

  1. You need Docker installed, it's required.

  2. Clone this repo.

  3. Create a .env file in the root directory,

 # server config
 APP_PORT=<your port>
 FRONTEND_ORIGINS=<comma separated list of frontend origins>
 FRONTEND_METHODS=<comma separated list of HTTP methods you want to allow>

 #db config
 DB_HOST=<database hostname>
 DB_PORT=5432
 DB_NAME=<database name>
 DB_USER=<database username>
 DB_PASS=<database password>

 # cache config
 CACHE_ENABLED=<true | false to enable/disable cache>
 CACHE_HOST=<cache hostname>
 CACHE_USER=<cache username>
 CACHE_PASS=<cache password>
 CACHE_PORT=6379
  1. create a integrations.env in root of the project,
 # Pgadmin 4 config , use these to login to pgAdmin
 PGADMIN_DEFAULT_EMAIL=[email protected]
 PGADMIN_DEFAULT_PASSWORD=12345

 # Postgresql config , these will be default user/pass credentials
 POSTGRES_USER=postgres
 POSTGRES_PASSWORD=postgres

 # redis-commander config, make sure redis settings below match your redis.conf settings.
 HTTP_USER=[email protected]
 HTTP_PASSWORD=12345
 PORT=8080
 REDIS_PORT=6379
 REDIS_HOST=cache
 REDIS_USERNAME=redis-user
 REDIS_PASSWORD=hrishix6
  1. Add your database schema commands in src/database/schema.sql, it will be used to initialize a database in postgres container.

  2. If you have your open api spec , paste it in src/openapi/spec.json, the documentation for api will be available at http://localhost:5000/docs (open).

How to run

$ docker compose up --build
  • Pgdmin4 will be accessible at http://localhost:8888 (open)

  • Redis GUI will be accessible at http://localhost:8080 (open)

  • Postgresql will be accessible at postgres://<db-user>:<db-password>@localhost:5432/<your-db-name>.

  • Redis server will be accessible at localhost:6379

  • As database and cache are accessible in docker network and localhost , during development you can switch hostname to localhost and run.

License

MIT

backend-template-2024's People

Contributors

hrishix6 avatar

Stargazers

 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.