This is a project template to create Blockstack apps using Svelte.
To create a new project based on this template you can either download an archive of the repository or use degit.
degit marvinjanssen/svelte-blockstack-template my-app
cd my-app
Note that you will need to have Node.js installed.
Install the dependencies and start the development server.
cd my-app
npm install
npm run dev
Navigate to localhost:5000. You should see your app running. Edit a component file in src
, save it, and reload the page to see your changes. The template contains sample components that manage Blockstack sign in and sign out and to show the user profile.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv
commands in package.json to include the option --host 0.0.0.0
.
To create an optimised version of the app:
npm run build
You can run the newly built app with npm run start
. This uses sirv, which is included in your package.json dependencies
so that the app will work when you deploy to platforms like Heroku.
You can also remove sirv as a dependency and roll your own server.
By default, sirv will only respond to requests that match files in public
. This is to maximise compatibility with static file servers, allowing you to deploy your app anywhere.
If you are building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for any path. You can make it so by editing the "start"
command in package.json:
"start": "sirv public --single"
Note that the template does not include a client-side router.