Skip to content

Samagra-Development/yaus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yet Another URL Shortener

Batteries included URL Shortener that is designed for speed and scalability.

Design

Docs here

Installation

Development

Pre-requisites

To run this project, you need to have the following pre-requisites installed:

Setup

  1. Clone the repository:
git clone https://github.com/Samagra-Development/yaus.git
  1. Navigate to the project directory:
cd yaus
  1. Create environment file:
cp sample.env .env
  1. Start the project dependencies using Docker Compose:
docker-compose -f docker-compose.local.yml up -d

The -d flag is used to run the containers in the background (detached mode). If you want to see the container logs, you can omit the -d flag.

Docker Compose will read the docker-compose.local.yml file and start the defined services.

  1. Verify that the containers are running:
docker-compose -f docker-compose.local.yml ps

This command will display the status of the containers defined in the docker-compose.local.yml file.

  1. Install app dependencies:
yarn install
  1. Run migrations:
npx prisma migrate dev --schema=apps/api/src/app/prisma/schema.prisma
  1. Seed data in the database (Optional):
npx prisma db seed

This command will seed the dummy data.

  1. Start the app:

To start backend app:

npx nx serve api

To start frontend app:

npx nx serve admin
  1. If everything is set up correctly, you should be able to access backend at localhost:3333/api. If this opens swagger ui your setup is correct. For frontend visit localhost:4200.

Production

Pre-requisites

To run this project, you need to have the following pre-requisites installed:

Setup

  1. Clone the repository:
git clone https://github.com/Samagra-Development/yaus.git
  1. Navigate to the project directory:
cd yaus
  1. Create environment file:
cp sample.env .env

You'd need to edit few things in the .env for prod. like for example you'd need to replace localhost with corresponding container name.

  1. Start the project using Docker Compose:
docker-compose -f docker-compose.prod.yml up -d

The -d flag is used to run the containers in the background (detached mode). If you want to see the container logs, you can omit the -d flag.

Docker Compose will read the docker-compose.prod.yml file and start the defined services.

  1. Verify that the containers are running:
docker-compose -f docker-compose.prod.yml ps

This command will display the status of the containers defined in the docker-compose.prod.yml file.

  1. Run migrations:
docker-compose -f docker-compose.prod.yml exec app bash

npx prisma migrate dev --schema=apps/api/src/app/prisma/schema.prisma

exit

First command will drop you into docker container and second command will run the migration and third will simply pull you out from container.

  1. Seed data in the database (Optional):
docker-compose -f docker-compose.local.yml exec app bash

npx prisma db seed

exit

This command will seed the dummy data.

  1. If everything is set up correctly, you should be able to access backend at localhost:3333/api. If this opens swagger ui your setup is correct.

Contributing

It is recommended to develop on Gitpod since everything is coupled with a bunch of dependencies. To start your Gitpod session click on the button below.

Open in Gitpod

The repo is structured as a monorepo using the Nx.

Contributors

A big thanks to all the contributors who have helped make this project possible!

Contributors