This sample project demonstrates how to deploy a full-stack application using Svelte for the frontend, Node.js for the backend, and MySQL for the database. The project uses Docker to containerize the services, making it easy to run in both development and production environments.
This sample showcases how you could deploy a full-stack application with Defang and Svelte and NodeJS. However, it deploys mysql db as a defang service. Defang services are ephemeral and should not be used to run stateful workloads in production as they will be reset on every deployment. For production use cases you should use a managed database like RDS, Aiven, or others. In the future, Defang will help you provision and connect to managed databases.
For development, we use a local container. This can be seen in the compose.yaml file and the server.js file where we create a pool of connections. To run the sample locally after clonging the respository, you can run on docker by doing docker compose up --build --build or run without using Docker by doing the following:
If you want to edit the database, such that you can deploy them to production, you should install the mySQL CLI and mySQL workbench to gain access to a GUI so that you can make your changes to the database. After running defang compose up these changes will be reflected.
defang login
defang compose up
in the CLI.Title: Svelte & Node.js & MySQL
Short Description: A full-stack application using Svelte for the frontend, Node.js for the backend, and MySQL for the database.
Tags: Svelte, Node.js, MySQL, Full-stack, JavaScript, TypeScript, SQL
Languages: nodejs