Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexgalhardo/little-url.alexgalhardo.com
Code Challenge to Create a URL Shortener
https://github.com/alexgalhardo/little-url.alexgalhardo.com
api docker nestjs nodejs postgresql prisma-orm swagger typescript url-shortener
Last synced: 20 days ago
JSON representation
Code Challenge to Create a URL Shortener
- Host: GitHub
- URL: https://github.com/alexgalhardo/little-url.alexgalhardo.com
- Owner: AlexGalhardo
- Created: 2024-08-10T17:53:24.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-14T17:44:20.000Z (6 months ago)
- Last Synced: 2025-01-03T05:33:26.703Z (26 days ago)
- Topics: api, docker, nestjs, nodejs, postgresql, prisma-orm, swagger, typescript, url-shortener
- Language: TypeScript
- Homepage: https://little-url.alexgalhardo.com
- Size: 339 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
https://github.com/user-attachments/assets/20d54596-9e0f-4e85-b745-a6fe0f2b175f
## Introduction
- Code Challenge to Create a URL Shortener
## Technologies
- [NodeJS](https://nodejs.org/en)
- [NestJS](https://nestjs.com/)
- [PrismaORM](https://www.prisma.io/)
- [Docker](https://docs.docker.com/)
- [PostgreSQL](https://www.postgresql.org/)## Features
- [x] CRUD API REST
- [x] Unit Tests using Jest Mocks
- [x] Git Hooks using Husky (pre-commit and pre-push)
- [x] Following clean architecture principles (use-case, repositories, dependency injection, IoC, etc)
- [x] CI/CD using Github Actions (linter, tests, build)
- [x] Middlewares to verify authentication & authorization
- [x] Migrations & Seeds & Database GUI
- [x] Swagger OpenAPI Specification v3 Documentation
- [x] Multi tenant (single database, shared schema)
- [x] Logs & Monitoring
- [x] Zod validation for payload requests
- [x] Security configs (rate-limiter, cors, exception errors handlers, etc)## How to improve
- [ ] API Gateway using KrankeD
- [ ] Add PM2 process manager
- [ ] Kubernetes for horizontal scaling
- [ ] Terraform
- [ ] Integration tests
- [ ] Load Balancer
- [ ] Improve healthcheck endpoint (databases conections, memory usage, etc)
- [ ] Use Git tags for releases
- [ ] Improve multi tenant approach## Development Setup Local
- Prerequisites:
- Install NodeJS version >= 20:
- Install Docker & Docker-compose:1. Clone repository
```bash
git clone [email protected]:AlexGalhardo/little-url.alexgalhardo.com.git
```2. Enter repository
```bash
cd little-url.alexgalhardo.com/
```3. Install dependencies
```bash
npm install
```4. Setup your environment variables
```bash
cp .env.example .env
```5. Create Migrations and Seeds
```bash
chmod +x setup.sh && ./setup.sh
```6. To Start Prisma Studio:
```bash
npm run prisma:studio
```7. Start local server
```bash
npm run dev
```## Build
a. Creating build
```bash
npm run build
```b. Testing build server locally
```bash
npm run start
```## Tests
a. Run all unit tests
```bash
npm run test
```## API Requests
- You can see the HTTP Requests references inside folder [rest-client/](rest-client/)
- You can also see Swagger API documentation in:
- Localhost:
- Live:## Documentation
- Read and add usefull documentation (markdown, notes, images, best practices, etc) about this project inside folder [docs/](docs/)## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) August 2024-present, [Alex Galhardo](https://github.com/AlexGalhardo)