A full-stack application that provides an interface for shortening long URLs. Simply paste a link and get a shortened version instantly.
git clone https://github.com/IvanDerlich/linkshortener.git
cd linkshortener- Docker CLI (includes Docker Compose): https://docs.docker.com/get-docker/ - Install the CLI tools, not Docker Desktop
- pnpm: Follow the official installation guide: https://pnpm.io/installation
You only need to set up environment variables in the backend folder. Create a .env file in the back-end directory.
There's no need to create other .env files in the frontend folder or in the root of the project.
For example:
# back-end/.env
DATABASE_CONNECTION_STRING=mongodb://localhost:27017/urlshortener
PORT=3000pnpm bootstrapSets up the database, installs dependencies, and starts the application
Why choose this: Easiest way to get started, perfect for development
Performance: Fast startup, hot reloading for quick iterations
Requirements: Just Docker CLI and pnpm installed
pnpm build-and-serveSets up the database, installs dependencies, builds frontend, then serves the application
Why choose this: Test how your app performs in production-like conditions
Performance: Optimized build, faster loading, better caching
Requirements: Same as Option 1, but takes longer due to build process
pnpm docker:allBuilds and runs all services in Docker containers
Why choose this: Consistent environment, easy deployment, team collaboration
Performance: Slightly slower startup, but identical across all machines
Requirements: Docker CLI installed, more disk space
For faster startup after initial setup, you can use these quick options:
-
pnpm start- Quickly launches both frontend and backend in development mode with hot reloading for fast iteration- Requires you to have run
pnpm bootstrapfirst
- Requires you to have run
-
pnpm serve- Serves the built frontend application and running backend, optimized for production-like performance- Requires you to have run
pnpm build-and-servefirst
- Requires you to have run
Regardless of the method you used to run the application, you can start using it with these endpoints
- Frontend: http://localhost:8080
- API Documentation (Swagger): http://localhost:3000/api/
- Backend API: http://localhost:3000
- Database
mongosh mongodb://localhost:27017/urlshortener- Node.js
- Express.js
- React.js
- MongoDB
- Mongoose
- Swagger
- Docker
- Docker Compose
- pnpm
- Axios
- React Router Dom
This project uses pnpm (performant npm) instead of npm for several key advantages:
- 🚀 Faster installations - Up to 2x faster than npm
- 💾 Disk space efficiency - Saves up to 50% disk space through content-addressable storage
- 🔗 Smart linking - Uses hard links and symlinks to avoid duplication
- 🏗️ Monorepo support - Built-in workspace management for frontend and backend
- 🔒 Stricter dependency resolution - Prevents phantom dependencies
If you encounter any issues while setting up or running the application:
📧 Email: [email protected]
🐛 Issues: https://github.com/IvanDerlich/linkshortener/issues
This project is licensed under the MIT License - see the LICENSE file for details.
Ivan Derlich - Full Stack Developer
- 🌐 Website: ivanderlich.com
- 📧 Email: [email protected]
- 💼 LinkedIn: Ivan Derlich
Built with ❤️ for you

