This is a project that demonstrate both client side component rendering and hydration as well as serverside rendering with external API route configuration. Furthermore, there is also a mongodb connection (not hosted on the atlas) to cache the queried results.
This sample showcases how you could deploy a full-stack application with Defang and Sveltekit. However, it deploys mongodb 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.
Download [Defang CLI] (https://github.com/DefangLabs/defang)
(optional) If you are using Defang BYOC make sure you have properly
[Docker CLI] (https://docs.docker.com/engine/install/)
For development, we use a local container. This can be seen in the compose.yaml and /src/routes/api/songs/+server.js 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
defang login
defang compose up
in the CLITitle: SvelteKit & MongoDB
Short Description: A full-stack application using SvelteKit for the frontend and MongoDB for the database.
Tags: SvelteKit, MongoDB, Full-stack, Node.js, JavaScript
Languages: nodejs