Sveltemongo screenshot

Sveltemongo

Author Avatar Theme by Thomasgysemans
Updated: 1 Aug 2023
7 Stars

SvelteKit App using MongoDB as backend with custom authentication.

Categories

Overview

The SvelteMongoSvelteKit App is a web application that uses MongoDB as its backend database and includes custom authentication and helper functions for handling file storage using GridFS. The app provides a template for quickly getting started with building projects using SvelteKit. It includes features such as user authentication, project management, and profile picture uploads.

Features

  • Custom authentication with encrypted user ID cookie
  • Secure and HTTP-only cookie with strict SameSite attribute
  • Automatic disconnection if user’s IP address changes during session
  • Easy deployment on Vercel with environment variable configuration
  • Helper functions for handling file uploads, downloads, replacements, renaming, and deletions using GridFS
  • Integration with FontAwesome for icons
  • SCSS and SASS support

Installation

To install the SvelteMongoSvelteKit App, follow these steps:

  1. Create a .env file at the root of your application and add the following variables:
MONGODB_CONNECTION_URI=<your_connection_uri>
DATABASE_NAME=<your_database_name>

Replace <your_connection_uri> with your own connection URI available in your personal space within MongoDB, and <your_database_name> with the name of the database you’ll be using in your project.

  1. Test the template by creating the necessary database collections:

    • users
    • projects
  2. To run the app, use the following command:

npm run dev

This will start the development server.

  1. Push your code to GitHub and deploy the app on Vercel. Make sure to store your secret variables in .env files and add them to .gitignore to protect sensitive information.

Summary

The SvelteMongoSvelteKit App is a project template that provides a streamlined development setup for building web applications with SvelteKit. It leverages MongoDB as the backend database and includes custom authentication and helper functions for handling file storage using GridFS. With features such as user management, project management, and profile picture uploads, the app allows developers to quickly get started and focus on building their web applications rather than setting up the basic infrastructure. Its integration with FontAwesome, SCSS, and SASS provides convenient tools for designing and styling the app.