Git Product home page Git Product logo

atidone's Introduction

Manage your Todos with Atidone ☑️

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

Deploy to NuxtHub

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

atidone's People

Contributors

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

Stargazers

Paul  avatar chong li avatar  avatar Alan avatar dev. ahnshy avatar Zhang Wentao avatar  avatar Edwin Chen avatar Jero Soler avatar Tu Nguyen avatar Jeffrey Turns avatar Ruslan Boliev avatar Alberto Monterroso avatar  avatar Ali Afghah avatar Alexey Pechenckin avatar  avatar SkidRow avatar Salam Yahya avatar Parsa Junior avatar Tao_sir avatar Andrei Luca avatar Nermal avatar MJ Schweiger avatar  avatar  avatar  avatar Shawn Liu avatar  avatar  avatar Anthony avatar Mahdiar Kaheh avatar rohit sohlot avatar bbauti avatar  avatar Phuc Le avatar Infinite Code Power avatar Okono Wilfried avatar 魏涛 avatar Son Tran avatar Min Khant Naung avatar Plusye avatar Costanza avatar Jorge Antezana avatar Leviathan avatar Ghyath avatar Web Developer avatar Ruje Alfon avatar ZaneReed avatar  avatar Jiang Menghao avatar Praise Mafo-Kwofie avatar  avatar Jesús Verduzco avatar Jitender Bansal avatar Felipe Valtl de Mello avatar Fanis avatar Sarakorn Sakol avatar Tapha Ngum avatar ChasLui avatar GLOW_ avatar lee avatar dominik avatar Larra Su avatar Jonathan avatar Fernando Bold avatar stonegate avatar Eddie avatar Al Asad Nur Riyad avatar Aasim Attia avatar Trịnh Huy Nam avatar Nischal Pandey avatar  avatar Andy Lu avatar Paul P avatar lishouming avatar Robin Simonklein avatar zuck avatar Mang avatar Benjamin VIELLARD avatar herryfox avatar Marko avatar xieydd avatar Utopia avatar James Lu avatar Nico van Zyl avatar Alfredo Martínez avatar Kevin Mendez avatar wydcode avatar N.S.Elvitigala avatar Ígor Jacaúna avatar Tsuyoshi Yamaguchi avatar Nurul Insani Dewi avatar Muris Ceman avatar  avatar Liang avatar Shane Pfaffly avatar ge.of avatar rere avatar nick avatar

Watchers

Jits avatar  avatar venkat avatar Kurt Rottmann  avatar  avatar  avatar

atidone's Issues

Regarding this code, 'if (! Import. meta. dev) return' will never be executed?

export default defineNitroPlugin(async () => {
  if (!import.meta.dev) return

  onHubReady(async () => {
    await migrate(useDB(), { migrationsFolder: 'server/database/migrations' })
      .then(() => {
        consola.success('Database migrations done')
      })
      .catch((err) => {
        consola.error('Database migrations failed', err)
      })
  })
})

Regarding this code, 'if (! Import. meta. dev) return' will never be executed? I think, In the Nitro plugin of Nuxt, import.meta.dev is usually not true.

Can not run locally via pnpm dev - Package import specifier "#internal/nitro/virtual/app-config" is not defined

I' m having an issue running this locally, strangely it deploys fine to Cloudflare - but I am unable to run it via dev.

ERROR  [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/app-config" is not defined in package /Users/gh/Documents/code/nuxt/edge-todo/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected]/node_modules/nitropack/package.json imported from /Users/gh/Documents/code/nuxt/edge-todo/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected]/node_modules/nitropack/dist/runtime/config.mjs

This is a fresh install cloned directly from the repo.

Package.json

{
  "private": true,
  "scripts": {
    "dev": "nuxi dev",
    "build": "nuxi build",
    "preview": "nuxt preview",
    "db:generate": "drizzle-kit generate",
    "lint": "eslint .",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@iconify-json/simple-icons": "^1.1.107",
    "@nuxt/eslint": "^0.3.13",
    "@nuxt/ui": "^2.17.0",
    "@nuxthub/core": "^0.7.0",
    "drizzle-kit": "^0.22.7",
    "drizzle-orm": "0.31.2",
    "h3-zod": "^0.5.3",
    "nuxt": "^3.12.2",
    "nuxt-auth-utils": "^0.1.0",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@nuxt/devtools": "^1.3.7",
    "@nuxt/eslint-config": "^0.3.13",
    "eslint": "^9.5.0",
    "typescript": "5.5.2",
    "wrangler": "^3.62.0"
  }
}

Running on an M2 2022 MacBook Air.
Tried on Node: v22.5.1 and v20.16.0 using pnpm v9.6.0

I have a similar issue trying to run the nuxt-ui-pro/docs template.

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?

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.

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.

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'

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.