Welcome to ShortURL, a monorepo containing two main components: the API and the App. The API is a robust Node.js backend, and the App is a dynamic Next.js frontend.
/api
: The Node.js backend developed with TypeScript, implementing Clean Architecture./app
: The Next.js frontend application.
This is a REST API developed with NodeJs, TypeScript, and Clean Architecture principles.
- Node version: 18.18.0
- Database: PostgreSQL
- TypeScript
- Tests: Jest
- Containers: Docker
Every command on the backend setup must be executed inside api folder.
-
In root folder, run:
cd api
-
Rename or copy the
.env.example
to.env
:cp .env.example .env
-
In the app root (the same dir where the package.json and this README are located), run:
docker compose up --build -d
This command will set up the databases and Redis containers.
-
If you have nodejs 18.08 installed locally, then execute:
npm install
-
If you don't have nodejs 18.08 installed locally, then I recommend installing nvm in your machine: Install NVM
Before starting the application, run migrations and seeders for both development and test databases.
-
Running migration for development:
npx sequelize-cli db:migrate
-
Running migration for test:
npx sequelize-cli db:migrate --env test
-
Running seeders for development:
npx sequelize-cli db:seed:all
-
Running seeders for test:
npx sequelize-cli db:seed:all --env test
-
Database Modeling:
-
Final Database Setup:
-
To execute:
npm run dev
-
For normal tests:
npx jest
-
With coverage:
npx jest --coverage
-
Postman Project:
The ShortURL App is a responsive and user-friendly frontend developed with Next.js. It provides a seamless interface for interacting with the ShortURL API, allowing users to create and manage shortened URLs efficiently.
Every command on the backend setup must be executed inside app folder.
-
In root folder, run:
cd app
-
To set up the frontend, start by installing the necessary dependencies:
npm install
-
Rename or copy the
.env.example
to.env
:cp .env.example .env.local
-
To execute:
npm run dev
- Lucas Sahdo - [email protected]
- My website: https://sahdo.io