Batteries included URL Shortener that is designed for speed and scalability.
To run this project, you need to have the following prerequisites installed:
- Docker: Download and install Docker
- Docker Compose: Download and install Docker Compose
- Clone the repository:
git clone https://github.com/Samagra-Development/yaus.git
- Navigate to the project directory:
cd yaus
- Create environment file:
cp sample.env .env
you may need to change few thing in .env
file according to you environment.
- Start the project 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.
- 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.
- Run migration in the database
docker-compose -f docker-compose.local.yml exec yausapp 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.
- Seed data in the database (Optional)
docker-compose -f docker-compose.local.yml exec yausapp bash
npx prisma db seed
exit
This command will seed the dummy data.
- If everything is set up correctly, you should be able to access your application at
localhost:3000/api
. If this opens swagger ui your setup is correct.
Note: You may want type hints as you code for that we would suggest you to install
node 16
andyarn 1
and run commandyarn install
for installing local node modules. Do note that this is only for getting type hints and syntax highlighting. Docker will only be using node_modules that is inside the container. If you make any changes topackage.json
then you have to rebuild the container usingdocker-compose -f docker-compose.local.yml up -d --build
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.
The repo is structured as a monorepo using the Nx.