/near-casino

Fake Casino built with Appwrite and Svelte Kit

Primary LanguageSvelteMIT LicenseMIT

🎰 Near Casino

Current Version

Cover

Cover

👋 Introduction

Near Casino is a fake online casino that supports one game - coin flip. The website is mainly useful for developers serving as demo application using Appwrite and Sveite Kit.

Project focuses on multiple aspects:

  • Appwrite Backend
  • Secure use of Appwrite
  • Svelte and Svelte Kit
  • SSR using Svelte (and Vercel)

Proof of server-side rendering kicking in properly with Appwrite and Svelte Kit (hosted on Vercel):

Cover

🤖 Tech Stack

Near Casino uses multiple frontend and backend technologies with focus of simplifying the development. Main focus of tech stack in this project is to make development fast and fun, instead of making it scalable and micro-optimized.

  • Appwrite, a secure backend as a service that provides 90% of necessary backend functionality out of the box
  • TailwindCSS, a CSS library to rapidly design components using HTML classes
  • Svelte, a JS library to build reactive frontend. Alongside this, application uses TypeScript
  • Svelte Kit, a Svelte framework to give proejct proper structure, routing and other cool features
  • Vercel, a static site hosting with amazing deployment flow using Git

💻 Development Setup

Frontend:

  1. Install dependencies: npm install
  2. Spin-up HTTP server: npm run dev
  3. Visit localhost:3000

Backend:

🚨 There is a bug in Vercel adapter! Please rename file from _appwrite.json to appwrite.json after cloning this repository. 🚨

You only need to spin-up backend if you man on backend changes. For frontend changes, you can skip this step as project is connected to production backend instance.

  1. Install Appwrite locally, or on development server
  2. Sign up into your Appwrite instance and create project with both name and ID set to nearCasino
  3. Install Appwrite CLI locally, and login: appwrite login
  4. Deploy collections: appwrite deploy collection
  5. Deploy functions: appwrite deploy functions, and configute environment variables in Appwite Web Console

To prepare your changes from your Appwrite instance database to production one:

  1. Pull database changes: appwrite init collection

To create a new function:

  1. Create function: appwrite init function

Feel free to do manual changes to appwrite.json if you are familiar with this file.

🚀 Deployment

Frontend:

  1. Install dependencies: npm install
  2. Build project: npm run build
  3. Deploy folder build on a static hosting

Frontend build does not use any special environment variables.

Backend:

  1. Deploy database changes, if necessary: appwrite deploy collection
  2. Deploy function changes, if necessary: appwrite deploy function

Assets used in the project made by Alex Martynov.


📚 Svelte Kit Resources (Generated)

Everything you need to build a Svelte project, powered by create-svelte.

Creating a project

If you're seeing this, you've probably already done this step. Congrats!!!

# create a new project in the current directory
npm init svelte

# create a new project in my-app
npm init svelte my-app

Developing

Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.