Skip to content

EnergieID/cofy-api-template

Repository files navigation

cofy-api-template

Template repository for spinning up a new cofy-api instance — the open-source modular framework by EnergyID for ingesting, standardising, and serving energy-related data.

Use this template: click "Use this template" on GitHub (or clone and rename) to start a fresh project. Then follow the steps below.

Quick start

Prerequisites

  • Python 3.12+
  • uv (fast Python package manager)

1. Install dependencies

uv sync

2. Configure environment

cp .env.example .env
# Edit .env and fill in your values

3. Enable your modules

Open main.py and add the modules you need (tariff, production, …). See cofy-api README for all available modules & options.

4. Run the dev server

poe dev          # starts FastAPI with auto-reload, reads .env

The API is now available at http://localhost:8000. Health-check: GET /health

5. Run a production-like container locally

poe prod         # builds the Docker image and runs it on port 8080

The container is available at http://localhost:8080. Health-check: GET /health

Development

Code quality (pre-commit)

Pre-commit hooks are configured out of the box. Install them once:

pre-commit install

Every commit will automatically run:

Tool Task Command
Ruff Linting + auto-fix poe lint
Ruff Formatting poe format
ty Type checking poe check

You can also run them manually at any time.

License

MIT

About

This is a template repo to easily setup your own cofy-api project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors