/express-postgres-template

A template to create a ExpressJS app using TypeScript that connects to PostgreSQL

Primary LanguageTypeScriptMIT LicenseMIT

Application Backend

Application Description

Inital setup

Prerequisites NodeJS LTS v18.14.0

  1. Install nvm on your machine
  2. run nvm install v18.14.0
  3. run nvm use
  4. Run npm install in the working directory to install required packages
  5. Reference .env.example and create your own .env file
  6. Run npm run db:create to create the database.
  7. Run npm run db:migrate to migrate models.
  8. Run npm run db:seed to seed database.
  9. Run npm run dev to start the development server

Documentation

File Structure and Naming Convention

src/
├─ consts/
│  ├─ enviroment.ts
│  ├─ userFriendlyMessages.ts
├─ controllers/
│  ├─ ExampleController.ts
├─ db/
│  ├─ migrations/
│  ├─ seeders/
│  ├─ index.ts
├─ middlewares/
├─ models/
│  ├─ Example.ts
│  ├─ index.ts
├─ repositories/
│  ├─ BaseRepository.ts
├─ routes/
│  ├─ ExampleRoutes.ts
├─ services/
│  ├─ ExampleService.ts
├─ types/
│  ├─ index.ts
├─ utils/
│  ├─ container.ts
│  ├─ dbUtils.ts
├─ app.ts
├─ server.ts

Commit Message Convention

  • Use Gitmoji to add emojis to your commit messages
  • Use the following format for your commit messages
    • feat: add new feature
    • 🐛 fix: fix a bug
    • ♻️ refactor: refactor code
    • 🎨 style: change styling
    • 🔥 chore: remove unused code
    • 📝 docs: update documentation
    • 📦 package: update package
    • 🚀 deploy: deploy to production
    • 🗑️ waste: remove unused code