See https://github.com/Flammans/artanova
This project is hosted on Railway (both API and database) but can be deployed on any platform that supports Node.js.
The backend is built using the Nitro framework, with PostgreSQL as the database.
The API retrieves artwork data from multiple configurable sources, such as:
- The Art Institute of Chicago: https://api.artic.edu/docs/
- The Metropolitan Museum of Art Collection: https://metmuseum.github.io
Data is fetched periodically to ensure the database remains up-to-date.
To automate this process, the project utilizes the Nitro tasks feature, functioning similarly to cron jobs. Artwork data is updated hourly, fetching the latest information from external sources and synchronizing it with the PostgreSQL database.
To trigger the update manually, you can open /update
.
You can run the server using Docker or manually.
Just
docker compose up
- Install requirements:
- Node.js v20
- PostgreSQL v16
- Create a database in PostgreSQL
- Create
.env
file withNITRO_DATABASE_URL
variable (see env vars) - Start the server:
npm run dev
Server configuration is done through environment variables.
For local development,
you can create a
.env
file in the root directory of the project
and set the necessary variables there.
Name | Description | Default Value |
---|---|---|
NITRO_DATABASE_URL | PostgreSQL database URL (for example postgresql://<username>:<password>@localhost:5432/<database> ) |
|
NITRO_ARTWORKS_LIMIT | Maximum number of artworks to fetch from each source per update (0 for unlimited) | 100 |
NITRO_JWT_SECRET | Secret key for JWT tokens (important to change in production) | secret |