Contributors is a GraphQL API written in Go. It stores data in MongoDB and uses Redis to cache and rate-limit requests. For monitoring, it integrates with Prometheus (Custom Metrics) and Grafana. The purpose of this API is to store open-source contributors and their contributions to various projects.
Contributors-Demo.mp4
To run the project locally, ensure you have the following installed:
- Golang
- MongoDB
- Redis
- Prometheus and Grafana (Only if you need monitoring)
Note:
Redis, Prometheus, and Grafana can be run using Docker. It's not feasible to run some services in Docker and others locally. For consistency, it is recommended to use Docker Compose to run all services.
-
Copy the
.env.example
file to.env
and update the values with your own configuration. Use the following bash command:cp .env.example .env
-
Install dependencies and start the server:
go mod download go run main.go
-
Access the API at
http://localhost:8080/
.
Make sure you have the following installed:
- Docker
- Docker Compose (Docker Compose is included with Docker Desktop)
-
Run the following command to start the services, including MongoDB, the Go API, Prometheus, and Grafana:
docker compose up
-
If you're using the latest version of Docker Compose, you can leverage the Compose Watch feature. This will automatically rebuild the application when code changes are made:
docker compose up --watch docker compose up --build --watch
-
You can now access the following:
- API:
http://localhost:8080/
- Prometheus:
http://localhost:9090/
- Grafana:
http://localhost:3000/
- API:
You can interact with the API using the GraphQL Playground, which will be available at http://localhost:8080/
when running locally. Alternatively, you can interact with the API via the /query
endpoint.
All Query and Mutation operations are defined in the operations.md file.
If you are using Grafana, you can import the pre-built dashboard from the grafana
directory.
This project is licensed under the GNU General Public License v3.0.
If you discover a security vulnerability within this project, please refer to the security policy for more information.