This project is a link-shortening service featuring a Single Page Application (SPA) built with vanilla JavaScript for the frontend and FastAPI for the backend. Project management is streamlined using a Makefile and the make
utility.
The Link Shortener Service is designed to provide users with an easy way to shorten long URLs. The application is structured as a SPA with FastAPI handling the backend functionalities. The project setup and management are facilitated through a Makefile, simplifying the environment setup, starting, and stopping processes.
Below is a visual representation of the project's routes:
To set up the project locally, follow these steps:
-
Environment Configuration:
- Create
env.dev
by following the example in.dist.env.dev
. - Similarly, create
env.test.local
by following the example in.dist.env.test.local
.
- Create
-
Set Up the Virtual Environment:
- Run
python -m venv env
to create a virtual environment. - Activate the environment:
- On Linux:
source ./env/bin/activate
- On Windows:
./env/Scripts/activate
- On Linux:
- It is recommended to run the setup on Linux as the startup scripts are implemented as bash scripts.
- Run
-
Starting the Development Environment:
- Use
make dev-start
to start the development environment. - After finishing your work, clean up by running
make dev-stop
.
- Use
-
Starting the Application:
- Execute
sh ./scripts/start.sh
to run the application.
- Execute
To deploy the application in production using Docker containers, follow these steps:
-
Environment Configuration:
- Create
env.prod
by following the example in.dist.env.prod
. - Similarly, create
env.test.prod
by following the example in.dist.env.test.prod
.
- Create
-
Starting and Stopping Containers:
- Start the production containers with
make prod-start
. - After the work is complete, clean up the environment with
make prod-stop
.
- Start the production containers with