AdminitY is a secure and modular admin panel built using Node.js, Express, Handlebars, and NeDB for database management. It is designed to handle user authentication, CRUD operations, and dynamic content rendering, providing a robust solution for admin interfaces.
- User Management: Easily create, update, and delete user records with different access levels (approved, lead).
- Dynamic Content Rendering: Handlebars templating engine for server-side rendering of views.
- Session Management: Secure session handling with user authentication via Telegram.
- Ajax-Based CRUD Operations: Handles operations asynchronously through RESTful endpoints.
- NeDB Integration: Lightweight, file-based database solution for managing user data.
- Customizable UI: Easily adaptable UI components with Handlebars, supporting conditional rendering and dynamic data display.
.
├── assets/ # Static assets (CSS, JS, Images)
├── data/
│ └── users.db # NeDB database for storing user information
├── views/
│ └── pages/ # Handlebars templates for rendering pages
├── index.js # Main server entry point
└── config.js # Configuration file (e.g., session secret, bot usernames)
-
User Authentication via Telegram
- The app uses a Telegram bot for login and verifies the username against an allowed list.
- It allows only authorized users to access the dashboard and settings.
-
User Management
- Add new users as either
approved
orlead
types. - Display a list of users, sorted based on the user type and other parameters like
timestamp
andusername
. - Users can be edited or removed dynamically using the provided endpoints.
- Add new users as either
-
CRUD Operations with NeDB
- Insert, update, and delete operations are supported for user data.
- NeDB is used to store user records in a local
users.db
file. - The app sorts and filters user data for different views like approved users and lead users.
-
Session and Authentication Middleware
- The application leverages Express sessions to store user data securely during their login session.
- Middleware ensures only authenticated users can access certain routes, like the dashboard or settings.
-
Dynamic Content Rendering
- Handlebars templates are used to render user-friendly and customizable web pages.
- Includes helper functions to format dates and conditionally display content based on data values.
-
Clone the repository:
git clone https://github.com/your-repo/AdminitY.git cd AdminitY
-
Install dependencies:
npm install
-
Configure environment variables in
config.js
:- Set your session secret, allowed Telegram usernames, and bot username.
-
Start the server:
npm start
The app will run on port
3008
by default. -
To use ngrok for local testing:
ngrok http 3008
The generated ngrok URL will be saved to
ngrok-url.txt
for external access.
- GET /login: Renders the login page for Telegram authentication.
- POST /auth/telegram: Authenticates users based on their Telegram credentials.
- GET /dashboard: Displays the admin dashboard for authorized users.
- GET /users: Lists approved users.
- POST /users: Adds a new user to the database.
- POST /users/:id/delete: Deletes an existing user.
- Add support for more user roles and access levels.
- Implement two-factor authentication for higher security.
- Expand database support to include MongoDB or PostgreSQL for larger-scale applications.