Skip to content

Latest commit

Β 

History

History
102 lines (79 loc) Β· 2.96 KB

File metadata and controls

102 lines (79 loc) Β· 2.96 KB

πŸ” Nuxt 3 + Appwrite Auth Boilerplate by ABTech

This is a production-ready Nuxt 3 starter project by ABTech, featuring complete Appwrite Authentication, middleware-based route protection, and Pinia for state management.

πŸ’‘ Features

  • βœ… 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

πŸ› οΈ Technologies

  • Nuxt 3 (Composition API)
  • Appwrite (Cloud or Self-hosted)
  • Pinia (State management)
  • Client-side Middleware

⚑ Quick Start

1. Clone the Repository

### 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