Que is a SvelteKit proof of concept application for browsing company data, powered by Cloudflare D1.
npm install -g wrangler)npm install
Create a D1 database:
npx wrangler d1 create que-db
Copy 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.js
Import 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 --local
Verify the import:
npx wrangler d1 execute que-db --command "SELECT COUNT(*) FROM companies;" --local
npm run dev
# or
npx wrangler dev
Build for production:
npm run build
Deploy to Cloudflare Pages:
npx wrangler pages deploy build
Note: For production, run the D1 import commands without --local flag to import into your production database.