Que is a SvelteKit proof of concept application for browsing company data, powered by Cloudflare D1.
- Node.js >= 20
- Wrangler CLI (
npm install -g wrangler)
npm installCreate a D1 database:
npx wrangler d1 create que-dbCopy the database_id from the output and update wrangler.json:
{
"d1_databases": [
{
"binding": "que_db",
"database_name": "que-db",
"database_id": "YOUR_DATABASE_ID_HERE"
}
]
}Generate SQL from CSV files in data/:
node scripts/csv_to_d1_sql.jsImport schema and data:
npx wrangler d1 execute que-db --file d1/schema.sql --local
npx wrangler d1 execute que-db --file d1/companies_inserts.sql --localVerify the import:
npx wrangler d1 execute que-db --command "SELECT COUNT(*) FROM companies;" --localnpm run dev
# or
npx wrangler devBuild for production:
npm run buildDeploy to Cloudflare Pages:
npx wrangler pages deploy buildNote: For production, run the D1 import commands without --local flag to import into your production database.