Skip to content

funnicus/nodejs-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS Template

A Node.js template for building RESTful APIs. Includes:

  • Node and pnpm
  • Express.js
  • TypeScript
  • Kysely query builder
  • Vitest
  • Docker
  • PostgreSQL
  • An example RESTful API
  • Wide events based logging
  • Otel tracing support
  • Metrics support for Prometheus

The project structures follows the Tao of Node, which I've found very useful during my career.

Logging follows the philosophy from this blog.

To further develop this template, I'd suggest semicolony.dev for ideas and inspiration.

Quickstart

You need to have

installed to run this application.

# Assumes linux (native or WSL) or macOS environment
cp .env.example .env

# Start the database and app in detached mode
docker compose up -d

pnpm install
pnpm run migrate:latest
pnpm run seed run

Open http://localhost:3000/api/v1/event/list and you should see a list of events!

Run docker compose down when you are done. Run docker compose down -v to remove volumes and clean up (removes data from the database!)

Development

Run:

# Config Git for rebase fast-forward flow
git config pull.rebase true
git config merge.ff only

# Assumes linux (native or WSL) or macOS environment
cp .env.example .env

# Start the database in detached mode
docker compose up -d db

pnpm install
pnpm run migrate:latest
pnpm run seed run
pnpm run dev

You are now ready to make changes!

Read CONTRIBUTING.md before making any changes.

Run docker compose down when you are done. Run docker compose down -v to remove volumes and clean up (removes data from the database!)

About

A template project for nodejs.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors