Front end and api is combined in 1 repo, since it is a small project. For scalability we can break them into two microservices.
- Next.js
- Postgresql as database
- pg-promise for database connection
- redux for store management
Make sure NodeJS version 10+ is installed on your machine.
brew install node
Installing nodemon
We use nodemon to reload the site whenever changes are made locally.
npm install -g nodemon
Once you have Postgres and Node, run these commands:
yarn
yarn dev
- brew install postgresql
- g_ctl -D /usr/local/var/postgres start && brew services start postgresql
- psql postgres
- CREATE ROLE prantik_de WITH LOGIN PASSWORD 'qwertyuiop';
- ALTER ROLE prantik_de CREATEDB;
- \q
- psql postgres -U prantik_de
- CREATE DATABASE url_shortening_db;
- GRANT ALL PRIVILEGES ON DATABASE url_shortening_db TO prantik_de;
- \list
- \connect url_shortening_db
- \q
npm run do-setup-database npm run do-seed-database
View http://localhost:5000 in your browser.
Test api health on http://localhost:5000/api/testcase url.