Giter VIP home page Giter VIP logo

decent-nextjs-starter-template's Introduction

Decent Next.js Starter Template

Quickly start a new Next.js project with defaults for UI components, layout, database setup and more.

By Joost Schuur (Twitter, Threads).

(Very) early work in progress. More to come.

Usage

Preliminary instructions. Start by cloning the repository:

git clone https://github.com/jschuur/decent-nextjs-starter-template
  1. Install dependencies: pnpm install.
  2. Rename decent-nextjs-starter-template in package.json to your project name.
  3. Optionally set up Turso. Local development will work fine without it.
  4. Copy .env.example to .env and fill in the values as desired.
  5. Run pnpm dev to start the development server. Visit http://localhost:3000.
  6. With the dev server running, run pnpm run db:migrate to set up the database. The dev script also runs the local Turso database instance. You can also run pnpm run dev:db:turso to run that separately.
  7. Populate the sample data with pnpm run db:seed. Refresh the local page to see the stack list loaded from the database.
  8. For SST based live development, set up your AWS credentials manually in ~/aws/credentials or via their CLI. If you don't want to use SST just yet, you can run local dev via pnpm run dev-nosst.
  9. For Auth.js, set up credentials for the Google Provider for AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET (or update auth.ts to use a different one). Don't forget the random AUTH_SECRET string.
  10. Test auth via the login button in the header. If you see an error, you might not have set the correct URLs for your Google OAuth credentials for 'Authorized JavaScript origins' (http://localhost:3000) and 'Authorized redirect URIs' (http://localhost:3000/api/auth/callback/google).
  11. To deploy, run pnpm run deploy (for a staging build) or pnpm run deploy:prod. This deploys to AWS via SST. Cloudflare deploys are also supported by SST Ion. Or use the Vercel CLI to deploy to Vercel. Create preview and production env files under .env.preview and .env.production respectively. Set a SITE_HOSTNAME to define the hostname for the site.

Substitute pnpm for your package manager of choice (npm, bun, yarn etc).

Stack

Hooks

  • useDialog: Open/close dialog management with type-safe dialog data reference via Zustand.

Components

Helpers

decent-nextjs-starter-template's People

Contributors

jschuur avatar

Stargazers

nnlychai avatar Paul Rogov avatar Crhistian J. Caraballo  avatar 义秋Henry avatar Adrian Payne avatar Michele Memoli avatar  avatar  avatar

Watchers

 avatar

Forkers

mmmoli

decent-nextjs-starter-template's Issues

$config is not defined

EXCITED to try this. A lot of great tools you've assembled together here.

Any specific setup instructions?

When I run bun run dev I get an error:

Error: $config is not defined

I get that:

  • Probs nothing to do with you
  • Could be because of bun instead of pnpm

Wondered if you had any thoughts?

Docs: Implementation notes on the site

A button on a card in the stack could open up a larger modal and show a few more details on each item and how it was configured/implemented (including offering alternatives e.g. to shadcn/ui, Turso or Drizzle).

Feature: Nav bar

  • logo/site name separate and optionally hidden in mobile
  • separate NavItem component
  • underline (with offset) current entry
  • load from array in main Nav component
  • drop down for responsive layout (might be separate task)
  • allow for shortened names in mobile view
  • comment for optional link prefetching

Feature: Cleanup command

Quick way to remove files that a new project doesn't need after cloning the repo.

  • two versions if you want to keep any of the sample implementations?
  • command could also rename references to 'decent-nextjs-starter-template'

Docs: Cleanup section

Cover steps on what to remove from a newly cloned version of the repo.

Ideally, there should be a cleanup command (#39)

Docs: Resources section

Start a Resource section with:

  • other stack alternatives
  • other people's boilerplates/templates
  • YouTube/Twitch channels for 'build in public' folks (e.g. WebDevCody,. Hosna, Kitze...)

BUG: Can't log out/session shared?

After a fresh deploy, hitting the log out button keeps you logged in. Visiting the URL under another Chrome profile also shows you as logged in.

Started working again 5-10 minutes later though. Specific to a redeploy?

Additional git stats

These can't all be pulled in from the basic GitHub repo data and will require API auth and several API calls:

  • days since last commit
  • number of contributors
  • number of total commits
  • commit message from last commit
  • number of branches?
  • date of last commit non main branch
  • create useGitHub stats hook
  • visualise some kind of history with a chart/sparkline: commits? (Tremor Raw Tracker or Spark Chart?)

Auth.js improvments

Split these off into individual issues:

  • magic link sign-in with template (@react-email)
  • email account login
  • custom login UI
  • refresh token
  • redirect centrally at middleware level?
  • API protected route example
  • Edge specific auth.js?
  • access user ID in session

Feature: Track dates for authenaticated users

  • createdAt (account creation)
  • lastLoggedInAt (full login?)
  • lastAuthenticatedAt (session auth; be smart here and don't do a DB write for every page access. Do this for new days or by interval threshold?)
  • add name of last created user to KPI cards

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.