A template project inspired by a curated list of designed patterns:
- DataMapper Pattern
- One way dependency
- Clean-Architecture
- Object-Oriented Programming
- Entity Driven API routes
config file
./src/config/env.config.ts
touch .env
then give environment variables as key-value pairs
PORT=8080
Install Packages
yarn install
Install Packages on CI/CD or production
yarn install --frozen-lockfile
Developement Commands
yarn dev
Build project
yarn run build
Run Project from build output
node ./dist
- Express.js (Http Server)
- aws-sdk (Used to generate presigned-urls for image uploads)
- cookie-session (Cookie Middleware)
- helmet (Security Middleware)
- moment (Date utility)
- morgan (Logging)
- PostgreSQL
- TypeORM
./Dockerfile
FROM node:alpine as builder
LABEL MAINTAINER="MOHAMED BELKAMEL"
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn run build
FROM node:alpine as runner
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN yarn install --frozen-lockfile
COPY --from=builder /app/dist ./dist
ENV NODE_ENV production
ENV PORT 8080
CMD ["node", "."]
Offers Multi-step build for minimum size image and maximum abstraction, end image contains only the runnable code
./.github/workflows/ci.yml
- pull request
main
- push
main
- Allows the Docker Image to be built on the CI server and pushed to the given Container Registry