Everything you need to build a Svelte project, powered by sv.
If you're seeing this, you've probably already done this step. Congrats!
# create a new project in the current directory
npx sv create
# create a new project in my-app
npx sv create my-appOnce you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --openWhen PUBLIC_SIERO_IMG_URL is empty, images are served from static/images/, a git-ignored mirror of the siero-img S3 bucket. To pull down anything missing without re-downloading what you already have:
cd static/images
aws s3 sync s3://siero-img/ . --size-only--size-only skips files that already match by size, even if their timestamps differ. Add --dryrun first to preview what will download.
-
Connect your Mac and phone to the same Wi-Fi network. Run
ipconfig getifaddr en0to find your Mac's Wi-Fi address (use the active network interface if it is noten0). The examples below use192.168.1.50; replace it with your address. -
In the API repository, start Rails with the exact frontend origin enabled:
DEV_CORS_ORIGINS=http://192.168.1.50:5174 bin/rails server -b 0.0.0.0
This requires the API's development CORS configuration from hensei-api#391.
-
In this repository, add or update this value in your existing gitignored
.env.localfile, preserving its other settings:PUBLIC_SIERO_API_URL=http://192.168.1.50:3000
Use the base URL without
/api/v1or/oauth; the app adds those paths.PUBLIC_SIERO_OAUTH_URLis not needed. Keep your existingPUBLIC_SIERO_IMG_URL: a CDN URL works from the phone, and an empty value uses this web server'sstatic/images/directory. Alocalhostimage URL needs to use your Mac's address instead. -
Run
pnpm dev:mobile, then openhttp://192.168.1.50:5174on your phone. The command keeps port 5174 fixed so it matches the API's allowed origin.
If the page does not load, allow incoming connections for Node and Ruby in your
Mac's firewall and check whether the Wi-Fi network isolates devices. If API
calls fail, check the configured IP, scheme and ports, and restart both servers
after changing environment settings. On your phone, localhost refers to the
phone, not your Mac. Use this setup on a trusted local network and stop the
servers when finished.
To create a production version of your app:
npm run buildYou can preview the production build with npm run preview.
To deploy your app, you may need to install an adapter for your target environment.