Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# CHANGELOG

## Unreleased
### Added
- docs: Added license

### Changed
- chore: Update dependencies
- docs: Update documentation

## 1.0.0 [02/11/2025]
### Added
Expand Down
78 changes: 78 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing to Iris API

Thank you for your interest in contributing to **Iris API** 🎉
We welcome all kinds of contributions — from bug reports and feature suggestions to code improvements and documentation updates.

---

## 🧑‍💻 Development

### Setup

1. Fork the repository and clone your fork locally.
2. Create a new branch from `main` for your changes.

```bash
git checkout -b feature/your-feature-name
```

### Linting

We use [`staticcheck`](https://staticcheck.io/) for Go code linting.
Before committing, make sure your code passes all lint checks:

```bash
staticcheck ./...
```

### Testing

Run the unit tests to ensure your changes do not break existing functionality:

```bash
go test ./...
```

### Mocks & Local Environment

You can run the project locally with mocked Firebase or database services by setting the appropriate environment variables (see the configuration documentation).
This allows development and testing without relying on external dependencies.

---

## 🧾 Code Guidelines

* Write **clean, well-documented code**.
Each exported function, struct, or method should have a GoDoc comment describing its purpose and behavior.
* Follow existing code style and structure.
* Keep commits focused and meaningful — one logical change per commit.
* Update or add tests when applicable.

---

## 🚀 Submitting Changes

1. Push your branch to your fork.
2. Open a **Pull Request (PR)** against the `main` branch.
3. In your PR description:

* Explain **why** you’re making the change.
* Describe **what** it does.
* Mention any relevant **issues** or **discussions**.

The maintainers will review your PR and may request changes or improvements before merging.

---

## 🧩 Versioning & Releases

* The current version is tracked in **`version.yaml`**.
* All version updates and notable changes must be documented in **`CHANGELOG.md`**.
* Follow [Semantic Versioning](https://semver.org/) when incrementing versions.

---

## 🙌 Acknowledgment

Once your contribution is merged, please **add your name** to the list of contributors in the `README.md` file under the “Contributors” section.
We appreciate your efforts and want to give you proper credit for your work.
674 changes: 674 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# iris API
# Iris API

Backend API for the iris mobile application.
![Iris logo](./docs/logo.png)

![Docker Image Version](https://img.shields.io/docker/v/roadtripmoustache/iris-api?sort=semver)
[![GitHub stars](https://img.shields.io/github/stars/RoadTripMoustache/iris-api?style=social)](https://github.com/RoadTripMoustache/iris-api/stargazers)

**Iris API** provides a RESTful interface to create, retrieve, and manage ideas, votes, and comments from users.
It powers the feedback system of Iris, enabling efficient collection of bug reports and feature requests directly from your user base.

---

This repository contains the Go codebase that powers the public HTTP API, including routing, controllers, services, data models, and integration with external providers (Firebase, MongoDB/Firestore, etc.).

Expand All @@ -12,30 +20,21 @@ This repository contains the Go codebase that powers the public HTTP API, includ

## Quick start

1) Configure the application
- Either edit config.yaml (local defaults) or provide environment variables described in docs/configs.md.
- If using real Firebase and database, place your service account JSON in a secure location and point FIREBASE_CREDENTIALS_FILE_PATH to it.
### Configure the application
Either edit config.yaml *(local defaults)* or provide environment variables described in [docs/configs.md](./docs/configs.md).

2) Run locally
- Native: go run ./main.go
- Docker: see docs/how_to/start_docker_image_locally.md
### Run locally
Use command `go run ./main.go`

3) Health check
- Once started, the API listens on the configured port (default :8080). You can verify by calling a simple GET on any public endpoint you have configured.
### Health check
Once started, the API listens on the configured port *(default :8080)*. You can verify by calling a simple GET on any public endpoint you have configured.

## Development
- Lint: staticcheck ./...
- Tests: go test ./...
- Mocks: You can enable mocked Firebase/database via environment variables (see docs/configs.md) to run locally without external services.
To help you, you can either use the [openapi.yaml](./docs/openapi.yaml) contract or use directly the [Postman collection](./resources/Iris%20API.postman_collection.json)

## Observability
- Prometheus metrics are exposed on a dedicated port (see server.metrics_expose in docs/configs.md).

## Security
- Authentication is backed by Firebase JWT. For help generating a test token, see docs/how_to/generate_token_with_firebase.md.
- Prometheus metrics are exposed on a dedicated port *(default :2121)* to help you monitore the API health.

## Versioning and releases
- Version is tracked in version.yaml and changes are documented in CHANGELOG.md.
---

## License
Proprietary — internal project of RoadTripMoustache / iris.
## Contribution
If you want to contribute, you can do it by **opening an issue**, or [contribute in the project](./CONTRIBUTE.md).
75 changes: 75 additions & 0 deletions docs/configs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Configs

This documentation details all the configurations available.

## Firebase
### YAML Structure
```yaml
firebase:
credentials_file_path:
project_id:
mock:
enabled:
data_file_path:
```

### Parameters
- `firebase.credentials_file_path` : *(Env variable : `FIREBASE_CREDENTIALS_FILE_PATH`)* - Path to the firebase credentials file
- `firebase.project_id` : *(Env variable : `FIREBASE_PROJECT_ID`)* - Project id of the firebase
- `firebase.mock.enabled` : *(Env variable : `FIREBASE_MOCK_ENABLED`)* - Set to `true` if you want to enable the mocks and do some specific tests.
- `firebase.mock.data_file_path` : *(Env variable : `FIREBASE_MOCK_DATA_PATH`)* - Path to the mock resources

---

## Database
```yaml
database:
mock:
enabled:
data_folder_path:
mongo:
uri:
name:
```

### Parameters
- `database.mock.enabled` : *(Env variable : `DATABASE_MOCK_ENABLED`)* - Set to `true` if you want to enable the mocks and do some specific tests.
- `database.mock.data_file_path` : *(Env variable : `DATABASE_MOCK_DATA_PATH`)* - Path to the mock resources
- `database.mongo.uri` : *(Env variable : `DATABASE_MONGO_URI`)* - URI path of the database
- `database.mongo.name` : *(Env variable : `DATABASE_MONGO_NAME`)* - Name of the collection to use in Mongo.

---

## Server
```yaml
server:
expose:
metrics_expose:
origins_allowed:
images_dir:
images_base_url:
```

### Parameters
- `server.expose` : *(Env variable : `SERVER_EXPOSE`)* - Port to expose the API. *Default 8080*
- `server.metrics_expose` : *(Env variable : `SERVER_METRICS_EXPOSE`)* - Port to expose the API metrics. *Default 2121*
- `server.origins_allowed` : List of the origins allowed to call the API
- `server.images_dir` : *(Env variable : `SERVER_IMAGES_DIR`)* - Folder where the images will be stored
- `server.images_base_url` : *(Env variable : `SERVER_IMAGES_BASE_URL`)* - Base path to call to get the images. By default need to be `/v1/images` if you use the API endpoint

---

## Images
```yaml
images:
maxImagesPerIdea:
maxImagesPerComment:
maxSize:
acceptedExtensions:
```

### Parameters
- `images.maxImagesPerIdea` : *(Env variable : `IMAGE_MAX_IMAGES_PER_IDEA`)* - Max number of images per idea
- `images.maxImagesPerComment` : *(Env variable : `IMAGE_MAX_IMAGES_PER_COMMENT`)* - Max number of images per comment
- `images.maxSize` : *(Env variable : `IMAGE_MAX_SIZE`)* - Image max site in bytes
- `images.acceptedExtensions` : List of file extensions allowed for file update.
Binary file added docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading