/next-appwrite-users

App that showcases how to use Next.js with Appwrite as its backend

Primary LanguageTypeScript

Appwrite Next.js Authentication

Next.JS App that uses Appwrite as its backend. It features:

Setup

Installing dependencies

Clone this repository and install its dependencies:

  # npm
  npm install
  # or yarn
  yarn

Setting up Environment Variables

Create a .env.local file based on the .env.local.example file included in the project. It should have the following values:

Value Description Example
NEXT_PUBLIC_APPWRITE_HOSTNAME The URL where your Appwrite server is hosted. Include the protocol and no trailing slash https://appwrite.example.com
NEXT_PUBLIC_APPWRITE_PROJECT_ID Your Project ID generated by Appwrite. You can get it from Your Project > Settings > Project ID (Screenshot) abc123abc123
APPWRITE_SECRET_API_KEY An API Key with permissions for users.read and users.write. (Screenshot) abcasdfpojo123432
ADMIN_TEAM_ID A team where all your users with Admin rights will be included. You can find the ID on Authentication > Teams > Select a team > Team ID. (Screenshot) 863451289065430265436

Launching the project

Run the project by using

npm run dev
# Or
yarn dev

API Routes

Route Description Requirements
users/all Gets an array with all the users that have registered in the app. User needs to be authenticated and part of the Admin team. Refer to Setting up Environment Variables for more information.
users/[id] Gets a single user based on their ID. If using me as the id, it will return the current user's profile. User needs to be authenticated to get their own profile, or to be part of the Admin team to get other users. Refer to Setting up Environment Variables for more information.

Support

If you need help with this app or found a bug, you can submit an issue on the Issues tab or by messaging me on Twitter @Axolodev

Screenshots

Simple login page with email and password fields User list on the home page. Every user has their name, email, and a link to their profile page. Very simple user profile. Just the user's name, email, and their first initial