Skip to content
/ nuxt-todos-edge Public template
forked from atinux/atidone

A todos application with user authentication, SSR and SQLite, working on the edge.

License

Notifications You must be signed in to change notification settings

pi0/nuxt-todos-edge

 
 

Repository files navigation

Nuxt Todo List on the Edge

A demonstration using Nuxt with server-side rendering on the edge, authentication and database querying using SQLite with CloudFlare D1 or Turso in production.

nuxt-todos-edge-demo.mp4

Live demos

Features

  • Server-Side Rendering on the Edge
  • Authentication backed-in
  • Leverage SQLite as database with migrations

Stack

  • Frontend:
    • Nuxt - The Vue Framework for Web Architects
    • NuxtLabs UI for styling and layout
  • Backend:

Setup

Make sure to install the dependencies using pnpm:

pnpm i

Create a GitHub Oauth Application with:

  • Homepage url: https://localhost:3000
  • Callback url: https://localhost:3000/api/auth/github

Add the variables in the .env file:

NUXT_GITHUB_CLIENT_ID="my-github-oauth-app-id"
NUXT_GITHUB_CLIENT_SECRET="my-github-oauth-app-secret"

To create sealed sessions, you also need to add NUXT_SESSION_SECRET in the .env with at least 32 characters:

NUXT_SESSION_SECRET=your-super-long-secret-for-session-encryption

Development

Start the development server on https://localhost:3000

npm run dev

Deploy on CloudFlare Pages

Create a CF pages deployment linked to your GitHub repository. Make sure to select Version 2 (Beta) as the build system version.

Environment variables

NUXT_GITHUB_CLIENT_ID=...
NUXT_GITHUB_CLIENT_SECRET=...
NUXT_SESSION_PASSWORD=...

Build command

Set the build command to:

npm run build

And the output directory to dist/

D1 Database

Lastly, in the project settings -> Functions, add the binding between your D1 database and the DB variable:

d1-binding

Copy the contents from server/db/migrations/0000_sloppy_starfox.sql into the D1 console to seed the database.

Turso Database

You can also use Turso database instead of CloudFlare D1 by creating a database and adding the following env variables:

TURSO_DB_URL=...
TURSO_DB_TOKEN=...

You can see a live demo using Turso on https://nuxt-todos-turso.pages.dev

License

MIT License

About

A todos application with user authentication, SSR and SQLite, working on the edge.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • TypeScript 55.0%
  • Vue 42.9%
  • JavaScript 2.1%