Setup
This guide provides instructions for setting up a complete development environment for Lyric, Overture's tabular data submission service.
Prerequisites
Before beginning, ensure you have the following installed on your system:
- PNPM (package manager, used instead of npm)
- Node.js (v20 or higher)
- Docker (for running containerized services)
Development Environment Setup
1. Clone the Repository
git clone https://github.com/overture-stack/lyric.git
cd lyric
2. Start Dependent Services
Lyric requires a PostgreSQL database for data storage and a running Lectern service to supply and validate dictionary schemas. The repository ships a docker-compose.yml that starts both dependencies (Postgres, plus Lectern and its MongoDB) with development defaults.
# From the repository root
docker compose up -d
Dependent Service Details
| Service | Port | Description | Purpose |
|---|---|---|---|
| PostgreSQL | 5432 | Relational database for Lyric | Stores submitted tabular data and audit history |
| Lectern | 3000 | Dictionary schema manager | Supplies and validates the schemas Lyric uses |
| MongoDB | 27017 | Backing store for Lectern | Stores Lectern's dictionaries and versions |
Important Notes:
- Ensure ports 5432, 3000, and 27017 are available on your system.
- Default Postgres credentials:
postgres/secret, databaselyric. - Adjust port configuration if conflicts exist with other services.
3. Install Dependencies
# Install all dependencies for the entire monorepo
pnpm install
4. Build the Workspace
# Compile TypeScript and generate the database schema
pnpm build:all
5. Configure Environment
Create a .env file from the provided schema:
cp .env.schema .env
The populated values in .env.schema match the services started in step 2, so a fresh clone runs without further editing. Every variable, what it controls, and its default is documented in Environment Variables, which is the single source of truth for configuration.
Kafka publishing is off unless you turn it on: KAFKA_BROKERS is blank by default and the bundled docker-compose.yml does not start a broker. Set KAFKA_BROKERS and KAFKA_TOPIC together to publish each commit for Maestro to consume.
6. Start the Development Server
# Runs database migrations, then starts the server with hot reloading
pnpm start:dev
The server runs on port 3030 by default.
Verification & Testing
API Documentation
Confirm the server is running by opening the interactive API documentation at Swagger UI. Every endpoint below can be exercised from there instead of curl.
Submission Testing
Lyric validates against dictionaries held in Lectern, so a dictionary has to exist in Lectern before Lyric can register it. The Lectern instance started in step 2 is empty on first run.
-
Upload a dictionary to Lectern. Lectern's
simple.jsonsample defines a singleprimitivesschema with one field of each type, which is enough to exercise the whole path:curl -sLO https://raw.githubusercontent.com/overture-stack/lectern/main/samples/dictionary/simple.jsoncurl -X POST http://localhost:3000/dictionaries \-H 'Content-Type: application/json' \-d @simple.json -
Register that dictionary against a Lyric category with
POST /dictionary/register.categoryName,dictionaryName, anddictionaryVersionare required, and the name and version must match what Lectern holds:curl -X POST http://localhost:3030/dictionary/register \-H 'Content-Type: application/json' \-d '{"categoryName": "sample-category","dictionaryName": "Simple","dictionaryVersion": "1.0","defaultCentricEntity": "primitives"}'The response carries the
categoryIdused by the remaining steps. The examples below assume1. -
Download the data file templates with
GET /dictionary/category/{categoryId}/templates. Lyric generates one blank file per schema in the registered dictionary, each named after its schema and carrying a header row, and returns them as a zip. No sample data of your own is needed. Templates are tab-separated by default; pass?fileType=csvfor comma-separated:curl -OJ http://localhost:3030/dictionary/category/1/templatesunzip Simple_1_templates.zip # contains primitives.tsv -
Submit a completed template with
POST /submission/category/{categoryId}/files, sending each file under thefilesform field.organizationis a required query parameter and groups the submission under a data-owning organization. Fill in a row or two of the template first:curl -X POST 'http://localhost:3030/submission/category/1/files?organization=example-org' \-F 'files=@primitives.tsv'The response carries a
submissionIdalong with any validation errors found. A submission stays staged until committed, so this step is safe to repeat while correcting data. -
Commit the submission with
POST /submission/category/{categoryId}/commit/{submissionId}to write the validated records to Postgres, substituting thesubmissionIdreturned above:curl -X POST http://localhost:3030/submission/category/1/commit/{submissionId}Confirm the records landed with
GET /data/category/1, or inspect the audit trail withGET /audit/category/1/organization/example-org.
Troubleshooting:
- Confirm all three containers are up and healthy:
docker compose psshould listlyric.db,lyric.lectern.db, andlyric.lectern.serviceasrunning. Usedocker compose logs -f <service>to follow a container that exited or is restarting. - Check that the ports are actually reachable rather than just bound:
curl http://localhost:3030/healthfor Lyric andcurl http://localhost:3000/healthfor Lectern. - If Lyric starts but every submission fails validation, confirm
LECTERN_URLpoints at the running Lectern service and that the dictionary name and version in your register call match a dictionary Lectern actually holds (curl http://localhost:3000/dictionaries). - Check the server logs for validation or database-migration errors.
If you encounter any issues or have questions about our API, please don't hesitate to reach out through our support page or our discussion forum.
Development Commands Reference
# Install dependencies
pnpm install
# Compile TypeScript and generate database schemas
pnpm build:all
# Run database migrations and start the server (development, hot reload)
pnpm start:dev
# Run database migrations and start the server (production, compiled)
pnpm start:prod
# Lint
pnpm lint
pnpm lint:fix
# Test
pnpm test
pnpm test:coverage
Docker Operations
# Build the Lyric server Docker image
docker build --no-cache -t lyric -f Dockerfile .
This guide is intended for development purposes only. For production deployments, implement appropriate security measures, configure authentication, and review all environment variables for your specific use case.