This is a Next.js project bootstrapped with create-next-app
.
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.tsx
. The page auto-updates as you edit the file.
- Modern Next.js 14 App Router
- TypeScript support
- Authentication with Email OTP and Web3
- Role-based access control
- Optimized font loading with
next/font
- Built-in analytics and logging
- Web3 wallet integration
The application uses a comprehensive authentication system built with React Context API. Here are the key features:
- Email Authentication: Uses OTP (One-Time Password) verification
- Web3 Authentication: Supports wallet-based authentication using SIWE (Sign-In with Ethereum)
- Role-Based Access Control: Implements granular access control with different user roles
-
Multiple Auth Methods
- Email login with OTP verification
- Web3 wallet authentication
- Support for linking multiple wallets to an account
-
Access Control
- Role-based access control (RBAC)
- Access level management
- Protected route handling
- Role verification helpers
-
Security Features
- Token-based authentication
- Automatic token refresh
- Secure session management
- Wallet signature verification
-
User Management
- User profile management
- Role management
- Session persistence
- Automatic session restoration
import { useAuth } from '@/contexts/AuthContext';
function MyComponent() {
const {
user,
isAuthenticated,
loginWithEmail,
loginWithWallet,
logout,
hasRole
} = useAuth();
// Check if user has specific role
const isAdmin = hasRole('ADMIN');
// Handle email login
const handleEmailLogin = async (email: string) => {
await loginWithEmail({ identifier: email });
};
// Handle wallet login
const handleWalletLogin = async (address: string) => {
await loginWithWallet(address);
};
}
The system supports different access levels:
- PUBLIC: Accessible to all users
- AUTHENTICATED: Requires user authentication
- ADMIN: Restricted to admin users
- EVENT_ORGANIZER: For event organizers
- EVENT_TEAM: For event team members
- CUSTOMER: For regular customers
For more details about the authentication implementation, refer to src/contexts/AuthContext.tsx
.
- Node.js 18.x or later
- npm, yarn, pnpm, or bun
- Git
- Clone the repository:
git clone https://github.com/yourusername/sasasasa-open.git
cd sasasasa-open
- Install dependencies:
npm install
# or
yarn install
# or
pnpm install
# or
bun install
- Create a
.env.local
file in the root directory and add necessary environment variables:
NEXT_PUBLIC_API_URL=your_api_url
NEXT_PUBLIC_WEB3_PROVIDER=your_web3_provider
# Add other required environment variables
- Start the development server:
npm run dev
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow the existing code style and conventions
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting a PR
Please read our Code of Conduct to keep our community approachable and respectable.
- Update the README.md with details of changes if needed
- Update the documentation if you're changing functionality
- The PR will be merged once you have the sign-off of at least one other developer
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.