Yamy · database seed scripts

Direct downloads for the three scripts that create and fill the Yamy database.

No credentials are inside these files. The MongoDB script reads its connection string from an environment variable you set yourself. Everything they create is sample data: no real people, no real orders, no real payments.

seed.mjs

23 KB · Node 22+ · no dependencies

Generates the whole sample dataset and writes database/seed.sql. With --db it also builds a ready SQLite file database/yamy.db from schema.sql plus that data: 40 restaurants, 348 menu items, 200 users, 10 couriers, 626 orders, 1,300 reviews, promos and addresses.

sha256 9e0d49d5a4a80dfb355a3c4ddffc5d8977da9081c8399128df2b2c56b4f3a772

seed-mongo.mjs

2.4 KB · Node 22+ · needs the mongodb driver

Copies the data from the SQLite file into a MongoDB database: 13 collections, 1,000 rows per batch, counters and indexes. Safe to re-run, it replaces the collections each time.

sha256 b186dda46354704a53565f58c6726c0acd746a1c66d6b8c880e604b13a3bd940

schema.sql

6.8 KB · SQLite / Cloudflare D1

The 13 tables with their indexes and the v_admin_stats view. Run it before seeding, on a local SQLite file or with wrangler d1 execute.

sha256 406a2850c5080dccf8df5aa3ce8b2d8b6ae939df86ffd00a03ab2967d0c8ec4b

How to run them

# 1. schema + data into a local SQLite file
node database/seed.mjs --db

# 2. or just generate the SQL file
node database/seed.mjs

# 3. copy the SQLite data into MongoDB (Atlas or local)
MONGODB_URI="your-connection-string" node backend/seed-mongo.mjs

# optional: push the schema to Cloudflare D1
npx wrangler d1 execute yamy-db --remote --file=database/schema.sql