# README
Smrv2 API
Smrv2 is a web scraper that scrapes schedules from the official website. The API is built with Go and Fiber.
Table of Contents
- Features
- Deployment
- Requirements
- Installation
- Usage
- Project Structure
- Contributing
- License
- Acknowledgements
Features
- Scrapes schedules from the official website
- Caches data in Redis
- Cron job to update data
- API Documentation with Swagger
- Docker support
Deployment
-
Koyeb
Requirements
- Go 1.23+
- PostgreSQL
- RabbitMQ
- Redis
- Docker
- Docker Compose
- Make
- migrate for database migrations
- air for hot reloading while developing
Installation
-
Clone the repository:
git clone https://github.com/savioruz/smrv2-api.git cd smrv2-api
-
Environment Variables:
Create a
.env
file in the root directory and add the following:cp .env.example .env
Usage
Running Application
You can run the API using Docker or directly with Make.
Docker
-
Run the application:
make docker.run
-
Stop the application:
make docker.stop
You need to have PostgreSQL, RabbitMQ, and Redis running on your machine.
Docker Compose (Recommended)
-
Build the application:
make dc.build
-
Run the application:
make dc.up
-
Stop the application:
make dc.down
For production, don't forget to set the environment in docker-compose.yml
if you want to expose the application to the public.
API Documentation
Swagger documentation is available at: http://localhost:3000/swagger.
Project Structure
.
├── assets/ # Asset files and images
├── cmd/ # Application entry points
├── db/ # Database related files
├── docs/ # Project documentation
├── internal/ # Private application code
│ ├── builder/ # Builder patterns
│ ├── dao/ # Data Access Objects
│ │ ├── entity/ # Entity models
│ │ └── model/ # Model for request and response
│ ├── delivery/ # HTTP handlers and routes
│ ├── gateway/ # External service integrations
│ ├── repository/ # Data storage implementations
│ └── service/ # Business logic layer
├── pkg/ # Public shared packages
│ ├── config/ # Configuration management
│ └── helper/ # Helper utilities
└── test/ # Test files
Contributing
Feel free to open issues or submit pull requests with improvements.
License
This project is licensed under the MIT License. See the LICENSE file for details.