This is a production-ready Nuxt 3 starter project by ABTech, featuring complete Appwrite Authentication, middleware-based route protection, and Pinia for state management.
- β User registration & login
- β Middleware-protected routes
- β Logout and session persistence
- β Detect current user on page load
- β Organized Pinia store for global auth state
- β Easy environment-based setup
- Nuxt 3 (Composition API)
- Appwrite (Cloud or Self-hosted)
- Pinia (State management)
- Client-side Middleware
### 1. Clone Repository
git clone https://github.com/Ex-007/nuxt-appwrite.git
cd nuxt-appwrite
### 2. Install Dependencies
npm install
### 3. Setting Up Appwrite
βΆοΈ Step 1: Create an Appwrite Account
Visit https://cloud.appwrite.io
Sign up for a free account
Click βCreate Projectβ
Give your project a name (e.g., NuxtAuth)
Copy the Project ID (youβll need this later)
βΆοΈ Step 2: Add Web Platform
Inside the project dashboard, click βAdd Platformβ
Choose βWeb Appβ
Set the host to: http://localhost:3000
Click βRegisterβ
βΆοΈ Step 3: Enable Email Auth
Go to Authentication β Users
Enable the Email/Password authentication method
π Environment Setup
Create a .env file in your project root and paste: APPWRITE_PROJECT=your_project_id
π¨ Don't commit this file. Keep your credentials secret.
π§ Project Structure
βββ middleware/
β βββ auth.client.js # Auth middleware
βββ plugins/
β βββ appwrite.client.js # Appwrite SDK setup
βββ stores/
β βββ authentication.js # Pinia store for auth
β βββ userDashboard.js # Pinia store for user Dashboard
βββ pages/
β βββ index.vue # home
β βββ account.vue # Login/Register page
β βββ dashboard.vue # User Dashboard page
βββ .env # Your credentials
π§ͺ Usage
Run the Dev Server
npm run dev
π§ How It Works
auth.client.js: Middleware for route protection
authentication.js: Pinia store for login, logout, session tracking
userDashboard.js: Pinia Store for user dashboard
appwrite.client.js: Plugin that Injects Appwrite into Nuxt app
.env: Keeps your credentials secure and dynamic
π§― Troubleshooting
Project ID Invalid? Make sure your .env is correct.
Appwrite error on load? Ensure auth.client.js is in middleware/ and named correctly.
Session not working? Check if cookies are allowed and APPWRITE_ENDPOINT is valid.
π Contribute
Pull requests and forks are welcome. You can use this as a base for:
Freelancer dashboards
SaaS platforms
Admin control panels
or any Nuxt app needing authentication!
π License
MIT β Free to use, remix, or distribute. Credit appreciated.
Built with β€οΈ by ABTech.
π Repo
https://github.com/Ex-007/nuxt-appwrite