Simple REST API using Express with TypeScript, PostgreSQL, and MySQL to practice the Clean Architecture by Uncle Bob.

Overview

Clean-Architecture

Simple REST API using Express with TypeScript, PostgreSQL, and MySQL to practice the Clean Architecture by Uncle Bob.

About

This REST API application implements the Clean Architecture in such a way that you can easily migrate between two RDBMS (PostgreSQL and MySQL) smoothly using a single environment variable DB_TYPE which can be toggled between pg and mysql in either .env file or docker-compose.yml depending on how are you running the application.

Installation

1. Clone the repo:

git clone https://github.com/abdullahalshawafi/Clean-Architecture.git

2. Move the project's directory:

cd Clean-Architecture/

3. Copy .env.example file into .env file and fill it with your environment variables:

cp .env.example .env

Using npm

Make sure you have Node.js, PostgreSQL, and MySQL installed

node -v
npm -v
psql -V
mysql -V

4. Install the needed npm packages:

npm install

5. Build the application:

npm run build

6. Start the application:

npm start

Using Docker and Docker Compose

Make sure you have docker and docker-compose installed on your UNIX based machine:

docker -v
docker-compose -v

4. Build the API's docker image:

docker build . -t employees

5. Run the application:

docker-compose up

6. Don't forget the stop the containers after you close the application:

docker-compose down

In either ways, the application should start and be running on http://localhost:8080

API Documentation

To generate the documentation use npm run docs. Then go to http://localhost:8080/api/v1 to view the generated documentation.

You might also like...

A Deno ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud

A Deno ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud.

Dec 15, 2022

A dockerized express mysql starter using typescript which iclude user management

A dockerized express mysql starter using typescript which iclude user management

Jan 26, 2022

Set up and build a Node.js REST API using Typescript, Express, Mongoose with a maintainable and scalable structure.

Introduction Create a maintainable and scalable Node.js REST API with TypeScript, Express and Mongoose. The project structure is based on MVC and foll

Nov 18, 2022

A sequence of smart contracts to practice gas optimization. These are used as practice assignments for RareSkills.io and the Udemy Gas Optimization Course

RareSkills Gas Puzzles Puzzles that are ready for you Distribute (hard) Array Sum (easy) Escrow EscrowV2 Mint Presale Require (easy) Staking Contribut

Dec 31, 2022

🐶 Puppies Rest Api built with NestJs, TypeOrm, PostgreSQL, Swagger

🚀 Quick start: Install node Install nest cli: `npm i -g @nestjs/cli` Initialize a nestjs project `nest new project-name` Swagger Docs swagger docs P

Oct 1, 2022

A clean-looking, secure, MySQL/MariaDB remote connection terminal made in NodeJS

A clean-looking, secure, MySQL/MariaDB remote connection terminal made in NodeJS

NodeJS MySQL/MariaDB Terminal NodeJS MySQL/MariaDB Terminal is a remote terminal for MySQL/MariaDB databases, which works in the same way as the offic

Jun 24, 2022

This is boilerplate of express, typescript and postgreSql with typeorm and docker based setup

express-typescript-postgres-typeorm-docker-swagger-boilerplate This is boilerplate of express, typescript and postgreSql with typeorm and docker based

Jun 2, 2022

A base API template for a REST API using express.

A base API template for a REST API using express.

express-api-template A base API template for a REST API using express. Philosophy Setting up a new project can be a long and tedious process, especial

May 29, 2022
Owner
Abdullah Adel
Senior Computer Engineering Student at Cairo University
Abdullah Adel
Personal project to a student schedule classes according his course level. Using GraphQL, Clean Code e Clean Architecture.

classes-scheduler-graphql This is a personal project for student scheduling, with classes according his course level. I intend to make just the backen

Giovanny Lucas 6 Jul 9, 2022
practice site to utilize node.js, Express, and mySQL

fishing_site practice site to utilize node.js, Express, and mySQL Run Locally create local instance of MySQL database. Run DB/fishing_Schema.sql to cr

Ryan Graue 1 Jan 22, 2022
Best discord msg nuker is back / sponsored by uncle cheng

socialnuke v2 the king of discord nukers is back :^) join https://discord.gg/technology :^) https://www.youtube.com/watch?v=_gLZHIpnKLY how 2: get nod

kek.st 5 May 11, 2022
Get-A-Room example application using Domain Driven Design and Clean Architecture. Written in TypeScript and deployed to AWS with a serverless stack.

Domain Driven Microservices on AWS in Practice This project provides a Domain Driven Design & Clean Architecture-informed, multi-service event-driven

Mikael Vesavuori 5 Dec 31, 2022
Uma api para encurtador url com typescript e Clean architecture.

Lyck ?? ??️ Esta e a parte de backend de um encurtador de link que estou a desevolver. tecnologias ?? ??️ Express. Joi. Uuid. Module-alias. BcryptJs.

Yazalde Filimone 5 Jan 28, 2022
A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snippets.

Warm Up ?? ??‍?? A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snipp

Arhun Saday 34 Dec 12, 2022
Project developed in typescript with clean architecture + tdd for demonstration purposes.

Description Project developed in typescript with clean architecture + tdd for demonstration purposes in Usystem. Installation $ yarn Running the app #

USystem - Desenvolvimento Ágil de Softwares 1 Oct 5, 2022
A Restaurant (Table) Reservation API built with Node, TypeScript, Express, TypeORM, a MySQL DB, all running on Docker containers

Restaurant (Table) Reservation API A simple API for reserving tables at a restaurant. The API is based on the REST architectural style and uses Node.j

null 14 Oct 5, 2022
A Restaurant (Table) Reservation API built with Node, TypeScript, Express, TypeORM, a MySQL DB, all running on Docker containers

Restaurant (Table) Reservation API A simple API for reserving tables at a restaurant. The API is based on the REST architectural style and uses Node.j

null 14 Oct 5, 2022
This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Eduardo Dantas 7 Jul 19, 2022