metw.cc API version 2 source tree.
Contributions are welcome! Please check our Code of Conduct before submitting pull requests.
AI-generated code is strongly discouraged.
The project exposes an OpenAPI specification at:
https://localhost:1186/openapi.json
This endpoint provides a complete machine-readable API schema that describes all available endpoints, request/response types, and authentication details.
You can view and interact with the API documentation using Swagger UI or any OpenAPI-compatible client.
Create a .env file (you can copy .env.example):
DATABASE_URL=postgres://metwcc:db_password@localhost:5432/metw-v2
REDIS_URL=redis://localhost/
JWT_SECRET=CHANGEME
HOST=127.0.0.1:1186These environment variables are used by the backend for connecting to PostgreSQL and Redis.
If the HOST environment variable is not set, the application will bind to the
local loopback address 127.0.0.1 on port 1186 by default.
You can start a local PostgreSQL instance using the provided Dockerfile inside
the db/ folder.
cd db
docker build -t metw-db .This setup maps the container’s internal PostgreSQL port 5432 to port 2345
on your host machine.
You can change the host port (2345) if needed -- just make sure to update the
DATABASE_URL accordingly. The internal container port (5432) should
remain unchanged.
docker run -d \
--name metw-db \
-p 2345:5432 \
metw-dbThis starts PostgreSQL with the initial schema defined in SQL files in db/.
For testing, use the .env.test file and a temporary database instance. By
default, the database Docker image does not include fixtures. If you want to
add mock data (from db/fixtures), you can enable it at build time by passing
the --build-arg fixtures=yes flag.
To start the test database:
cd db
docker build --build-arg fixtures=yes -t metw-db-test .
docker run -d -p 2345:5432 --name metw-db-test metw-db-testNote: You need to enable fixtures to run tests.
Once the test database is up, you can run your tests:
cargo testThese commands stop and remove both the development and test database containers. If you only want to remove one of them, simply pass its name as an argument.
docker stop metw-db metw-db-test
docker rm --force metw-db metw-db-testVersions >0.1.0-rc.1 licensed under GNU Affero General Public License.