Getting Started

npx create-sonicjs-app

The above script will automatically rename /wrangler.example.toml to /wrangler.toml and update the 4 required Cloudfalre values:

compatibility_date = "2023-05-18"
name = "sonicjs"
workers_dev = true
main = "src/server.ts"

# Enter your account id
# This can be found at --> Workers & Pages
#  --> Overview, then in the right sidebar
account_id = "?????"

# Run the `wrangler kv:namespace create sonicjs` command and copy the id below
# Run the `wrangler kv:namespace create sonicjs --preview` command and copy the preview_id below
# Only update the preview_id and id, leave the binding name as "KVDATA"
kv_namespaces = [
  { binding = "KVDATA", preview_id="?????", id = "?????" }

# Run the `wrangler d1 create sonicjs` command and copy the id below
binding = "D1DATA"
database_name = "sonicjs"
database_id = "?????"

Now you are ready to fire up SonicJs!

npm run dev

This will run the server locally on port 8788:

The next thing you will want to do is define your database table(s) and read up on SonicJs's built in caching and persistence layers.