Anyone Services II
Setting Up Services on the Anyone Network
Integrate SvelteKit with nginx, anon, and anyone-client
This is a follow up from Anon Services I, where we'll give an example of another application set up as a service on the Anyone Network.
"Svelte is a UI framework that uses a compiler to let you write breathtakingly concise components that do minimal work in the browser, using languages you already know — HTML, CSS and JavaScript. It’s a love letter to web development.
But don’t take our word for it. Developers consistently rank Svelte as the framework they’re most excited about using."
Let's start!
If you haven't followed the steps in the previous chapter, go ahead and do so before you continue following along in the instructions below.
Set up nginx for SvelteKit
Create a new nginx configuration for the Svelte service:
Add this configuration to route requests to the Svelte app:
Enable Svelte and Reload nginx:
Configure anyone-client and anon for Svelte
Add port mapping for Svelte to existing anonrc
configuration:
If you followed the steps in Anon Services I, we created our custom anonrc in the ./anon
folder. Append the port mapping to the configuration with this command:
Set up and build the SvelteKit application
Create a project directory:
Initialize the project:
See SvelteKit documentation for more information about setting up projects. We chose these options for the example:
Install dependencies:
Configure the SvelteKit Node Adapter:
Edit the svelte.config.js
file located in your project folder.
Change the import
line to import the new adapter-node
:
Load environment variables:
Add a .env
file with PORT
and HOSTNAME
:
Build the project:
Move the build output to /var/www/my-svelte-anon-app:
Testing the Svelte-based anon service
Confirm that the app is accessible locally at http://127.0.0.1:5173
:
Access the service via SOCKS5:
Hostname located at: ./anon/anon_service/hostname
Last updated