GithubHelp home page GithubHelp logo

atinux / nuxt-todos-edge Goto Github PK

View Code? Open in Web Editor NEW
574.0 6.0 56.0 1.73 MB

A full-stack application with authentication, SSR and SQLite, running on the edge with Nuxt 3.

Home Page: https://todos.nuxt.dev

License: MIT License

JavaScript 1.09% Vue 58.03% TypeScript 40.88%
esr nuxt sqlite ssr vue cloudflare-d1 drizzle-orm nuxt-ui nuxthub

nuxt-todos-edge's Introduction

Nuxt Todo List on the Edge

A demonstration using Nuxt with server-side rendering on the edge, authentication and database querying using Cloudflare D1.

Features

Live demo

https://todos.nuxt.dev

nuxt-todos-edge-demo.mp4

Setup

Make sure to install the dependencies using pnpm:

pnpm i

Create a GitHub Oauth Application with:

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

Add the variables in the .env file:

NUXT_OAUTH_GITHUB_CLIENT_ID="my-github-oauth-app-id"
NUXT_OAUTH_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 http://localhost:3000

npm run dev

In the Nuxt DevTools, you can see your tables by clicking on the Hub Database tab:

drizzle-meets-nuxt-devtools.mp4

Deploy

You can deploy this project on your Cloudflare account for free and with zero configuration using NuxtHub.

npx nuxthub deploy

It's also possible to leverage Cloudflare Pages CI for deploying, learn more about the different options on https://hub.nuxt.com/docs/getting-started/deploy

Remote Storage

Once you deployed your project, you can connect to your remote database locally running:

pnpm dev --remote

Learn more about remote storage on https://hub.nuxt.com/docs/getting-started/remote-storage

License

MIT License

nuxt-todos-edge's People

Contributors

arashsheyda avatar atinux avatar barbapapazes avatar benjamincanac avatar duboiss avatar fayazara avatar michael avatar pi0 avatar yuemeng200 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nuxt-todos-edge's Issues

Unable to run npm run build

when running npm run build.
I got following error.

ERROR [vite:vue] Could not load /node_modules/nuxt-icon/dist/runtime/IconCSS.vue?vue&type=style&index=0&scoped=41e8d397&lang.css?inline&used: ENOENT: no such file or directory, open '\?\node_modules\nuxt-icon\dist\runtime\IconCSS.vue'

Database isn't re-queried for updates when mutating or adding data

It looks like the database isn't re-queried for updates when mutating or adding data.

Example:
Open two browser windows with the same login. Add a new todo in window 1. Then go to window 2 and add another new todo. You would expect window 2 to not only add it's own todo, but also now show the todo that window 1 entered. If you do a hard refresh in window 2, the todo entered in window 1 will now show.

When posting, patching, or deleting to an endpoint, shouldn't a fresh copy of the todo's be retrieved from the database instead of just adding the changes to the in-memory array?

Why can't I access properties of the user inside the <script> tags?

In todos.vue if I change toast.add({ title: `Todo "${todo.title}" created.` }) to toast.add({ title: `Todo "${todo.title}" created by ${user.login}.` }) it will show as undefined, but the property is accessible inside the template.

I'm coming from Nuxt 2 so this might be me misunderstanding how SSR works in Nuxt 3. Why aren't the properties of user accessible here and how would I go about exposing them?

I apologise if this is the wrong place to ask this question.

Deploying to Azure Static Web App

Thanks for creating this end-to-end demo of Nuxt3.

After removing the auth related code, I could successfully deploy it to Azure using the docs.

But I am really struggling to make it work with auth code.

The issue is, redirect_uri sent by SWA to github does not match the callback url specified in the Github OAuth aap.

I thought this setting may help, but tweaking it has not helped so far.

It will be great, if the README includes guidance on deploying to Azure as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.