Skip to content

The most advanced platform for curriculum planning and attendance management, designed for smooth academic management.

Notifications You must be signed in to change notification settings

Premshaw23/Learnova

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

85 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.js. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details

Premium Authentication System - App Router Version

A modern, role-based authentication system built with Next.js 13+ App Router, Firebase, and Tailwind CSS.

πŸ“ App Router File Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   └── page.jsx              # Main authentication page
β”‚   β”œβ”€β”€ verify/
β”‚   β”‚   └── page.jsx              # Email verification page (create as needed)
β”‚   β”œβ”€β”€ profile/
β”‚   β”‚   └── page.jsx              # Profile setup page (create as needed)
β”‚   β”œβ”€β”€ student/
β”‚   β”‚   └── dashboard/
β”‚   β”‚       └── page.jsx          # Student dashboard
β”‚   β”œβ”€β”€ teacher/
β”‚   β”‚   └── dashboard/
β”‚   β”‚       └── page.jsx          # Teacher dashboard
β”‚   β”œβ”€β”€ institute/
β”‚   β”‚   └── dashboard/
β”‚   β”‚       └── page.jsx          # Institute dashboard
β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   └── dashboard/
β”‚   β”‚       └── page.jsx          # Admin dashboard
β”‚   β”œβ”€β”€ layout.jsx                # Root layout
β”‚   └── page.jsx                  # Home page
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ AuthForm.jsx              # Main authentication form
β”‚   β”œβ”€β”€ RoleSelection.jsx         # Role selection interface
β”‚   β”œβ”€β”€ HeroSection.jsx           # Marketing/hero content
β”‚   β”œβ”€β”€ ForgotPasswordModal.jsx   # Password reset modal
β”‚   └── Navbar.jsx                # Navigation component
β”‚
β”œβ”€β”€ constants/
β”‚   └── userRoles.js              # User roles and configurations
β”‚
β”œβ”€β”€ services/
β”‚   └── authService.js            # Firebase authentication services
β”‚
β”œβ”€β”€ utils/
β”‚   └── authUtils.js              # Authentication utility functions
β”‚
β”œβ”€β”€ hooks/
β”‚   └── useAuth.js                # Custom authentication hook
β”‚
└── lib/
    └── firebaseConfig.js         # Firebase configuration

πŸ”„ Key Changes for App Router

1. File Locations

  • Before (Pages Router): pages/auth.jsx
  • After (App Router): app/auth/page.jsx

2. Navigation Import

// App Router uses next/navigation instead of next/router
import { useRouter } from "next/navigation";

3. Component Export

// App Router pages export default function
export default function AuthPage() {
  // Component logic
}

4. Route Structure

The routing in App Router is based on folder structure:

  • /auth β†’ app/auth/page.jsx
  • /verify β†’ app/verify/page.jsx
  • /student/dashboard β†’ app/student/dashboard/page.jsx

πŸš€ Setup Instructions for App Router

1. Create the Required Pages

app/verify/page.jsx (Email Verification):

"use client";
export default function VerifyPage() {
  return (
    <div className="min-h-screen flex items-center justify-center">
      <div className="text-center">
        <h1>Check Your Email</h1>
        <p>We've sent you a verification link.</p>
      </div>
    </div>
  );
}

app/profile/page.jsx (Profile Setup):

"use client";
export default function ProfilePage() {
  return (
    <div className="min-h-screen flex items-center justify-center">
      <div className="text-center">
        <h1>Complete Your Profile</h1>
        {/* Profile setup form */}
      </div>
    </div>
  );
}

Dashboard Pages (create as needed):

// app/student/dashboard/page.jsx
"use client";
export default function StudentDashboard() {
  return <div>Student Dashboard</div>;
}

// app/teacher/dashboard/page.jsx
"use client";
export default function TeacherDashboard() {
  return <div>Teacher Dashboard</div>;
}

// app/institute/dashboard/page.jsx
"use client";
export default function InstituteDashboard() {
  return <div>Institute Dashboard</div>;
}

// app/admin/dashboard/page.jsx
"use client";
export default function AdminDashboard() {
  return <div>Admin Dashboard</div>;
}

2. Root Layout (app/layout.jsx)

import './globals.css'

export const metadata = {
  title: 'Premium Auth System',
  description: 'Role-based authentication system',
}

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  )
}

3. Updated Auth Utils for App Router

The redirectBasedOnRole function works the same way since we're using router.push() from next/navigation.

πŸ”§ Implementation Steps

  1. Create the folder structure as shown above
  2. Move/create files in their respective App Router locations
  3. Update imports to use next/navigation
  4. Create missing pages (verify, profile, dashboards)
  5. Test the routing to ensure all redirects work properly

πŸ“‹ App Router Benefits

  • Faster navigation with client-side routing
  • Better SEO with server-side rendering support
  • Simplified routing based on file system
  • Improved performance with automatic code splitting
  • Better TypeScript support (when using TypeScript)

🚨 Important Notes

  1. All interactive components must use "use client" directive
  2. Server components can be used for static content (like layouts)
  3. Metadata is handled differently in App Router
  4. Error handling and loading states work similarly
  5. Route groups can be used with (auth) folders if needed

πŸ”„ Migration Checklist

  • Move pages/auth.jsx to app/auth/page.jsx
  • Update imports from next/router to next/navigation
  • Add "use client" to interactive components
  • Create missing dashboard pages
  • Create verify and profile pages
  • Update any API routes (if using)
  • Test all authentication flows
  • Test role-based redirections

This structure follows Next.js 13+ App Router conventions and provides better performance and developer experience!

About

The most advanced platform for curriculum planning and attendance management, designed for smooth academic management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages