Small local Fastify service for ChekIt ingredient matching.
If you are an AI helping set this repo up, do this first:
cd /Users/clank/Projects/ChekIt/chekit-core
npm install
cp .env.example .env
npm run init-db
npm run import-data
npm run smoke
npm run devThen verify:
curl -s http://127.0.0.1:3333/health
curl -s -X POST http://127.0.0.1:3333/api/check \
-H 'content-type: application/json' \
-d '{"ingredientString":"Water, Cocos Nucifera, Isopropyl Myristate"}'Expected result: Cocos Nucifera matches Coconut Oil, and Isopropyl Myristate matches Myristate.
- Stores ingredient items in SQLite.
- Builds the local SQLite database from the checked-in
data/ingredients.jsonseed. - Checks a submitted ingredient list against canonical ingredient names and known synonyms.
- Returns matched ingredients with synonym details.
- Runs locally with Node or Docker Compose.
If you want to contribute:
- Fork
https://github.com/JoshAquila/chekit. - Clone your fork:
git clone https://github.com/<your-username>/chekit.git
cd chekit- Install dependencies and build the local SQLite database:
cp .env.example .env
npm install
npm run import-data
npm run devThe API listens on http://localhost:3333 by default.
For local data:
npm run import-datacp .env.example .env
docker compose up --buildSQLite is stored in the chekit-core-data Docker volume.
This repo includes render.yaml for Render Blueprint deploys.
Important Render behavior:
- Render does not deploy
docker-compose.ymldirectly for this service. - Render builds from
Dockerfileviaruntime: docker. - The service binds to
HOST=0.0.0.0and Render'sPORT=10000. - SQLite is stored on a persistent Render disk mounted at
/app/storage. preDeployCommand: npm run import-databuilds SQLite from/app/seed/ingredients.jsonbefore the service starts.
Deploy steps:
- Push this repo to GitHub.
- In Render, create a new Blueprint from the repo.
- Select the
render.yamlBlueprint. - Deploy and verify
/health.
No Postgres URL is required for the public open-source deploy path. ChekIt Core builds SQLite from data/ingredients.json.
The public data source is data/ingredients.json. Each ingredient includes:
namecauses_acnedescriptionface_realitycomedogenic_scoresynonyms
To rebuild local SQLite from the public data file:
npm run import-dataPrivate maintainers can refresh data from Postgres when they have credentials. Set POSTGRES_URL in .env, then run:
npm run import-postgresTo export the current Postgres ingredient rows to JSON instead:
npm run export-postgresThat writes data/ingredients.export.json.
This is a legacy fallback for local development:
npm run import-backend-seedBy default it reads ../acne-checker-backend/src/db/seeds/01_ingredients.js.
Copy examples/chekit-core-client.js into the frontend, or import it directly during local development.
Basic usage:
import { createChekItCoreClient } from './chekit-core-client.js';
const chekit = createChekItCoreClient({
baseUrl: import.meta.env?.VITE_CHEKIT_CORE_URL || 'http://localhost:3333'
});
const result = await chekit.checkIngredients({
ingredientString: 'Water, Cocos Nucifera, Isopropyl Myristate'
});
console.log(result.matches);Suggested frontend env var:
VITE_CHEKIT_CORE_URL=http://localhost:3333Returns service health.
Returns SQLite ingredient rows and their synonyms.
Use faceReality=true to return only ingredients flagged by Face Reality:
curl -s "http://127.0.0.1:3333/ingredients?faceReality=true&limit=100"Checks an ingredient list. /check is also registered locally, but /api/check is the recommended hosted endpoint.
Request:
{
"ingredientString": "Water, Cocos Nucifera, Glycerin",
"onlyFaceReality": false
}You can also pass an array:
{
"ingredients": ["Water", "Cocos Nucifera", "Glycerin"]
}Response:
{
"inputIngredients": ["water", "cocos nucifera", "glycerin"],
"matchCount": 1,
"matches": [
{
"id": 1,
"name": "coconut oil",
"normalizedName": "coconut oil",
"causesAcne": true,
"description": "Example",
"comedogenicScore": 4,
"comedogenicRating": "high",
"faceReality": true,
"synonyms": ["cocos nucifera"],
"matchedInputs": [
{
"input": "cocos nucifera",
"normalizedInput": "coconut oil",
"matchedVia": "synonym",
"synonym": "cocos nucifera"
}
]
}
]
}src/server.js: Fastify app and routes.src/db.js: SQLite schema, imports, list/check queries.src/normalize.js: ingredient parsing and synonym normalization.data/ingredients.json: public ingredient data seed.scripts/import-ingredients-json.js: builds SQLite fromdata/ingredients.json.scripts/import-postgres-to-sqlite.js: pulls private Postgres ingredients into SQLite when credentials are available.scripts/import-backend-seed.js: imports checked-in backend seed data.examples/chekit-core-client.js: copy-paste frontend API client.data/chekit.sqlite: generated local SQLite DB, ignored by git.
PORT: API port. Default:3333.HOST: API host. Default:0.0.0.0.SQLITE_PATH: SQLite database path. Default:./data/chekit.sqlite.POSTGRES_URL: optional Postgres connection string for private maintainer import/export scripts.POSTGRES_SSL: set totruefor hosted Postgres requiring SSL.
This project is licensed under AGPL-3.0-only. The full license text is in LICENSE.
This service does not mutate the existing Bitbucket backend. It is a standalone open-source ChekIt core.