A modern, full-stack template built with Astro and Tailwind CSS, featuring authentication, dashboard, API endpoints, and reusable UI components.
- 🚀 Built with Astro and Tailwind CSS
- 🔒 Authentication (Login/Register) with hashed passwords and JWT-like session tokens
- 📊 Dashboard with live statistics and recent activity
- ⚙️ User settings management (dark mode, notifications)
- 🌙 Dark mode support (auto and manual toggle)
- 📱 Responsive, accessible design
- 🔄 RESTful API endpoints for CRUD operations
- 🧩 Reusable components: Toast, Dropdown, Popup
- 🗄️ SQLite database (via better-sqlite3)
- 🛡️ Secure password storage (SHA-256 hashing)
- 🧑💻 Developer-friendly project structure
Astro Template/
├── public/ # Static assets (favicon, etc.)
├── src/
│ ├── components/ # Reusable UI components (Toast, Dropdown, Popup)
│ ├── layouts/ # Page layouts (Base, Auth, Dashboard)
│ ├── lib/ # Server-side logic (auth, database, dashboard)
│ ├── pages/ # Astro pages and API routes
│ │ ├── api/ # API endpoints (auth, users, dashboard)
│ │ ├── auth/ # Auth pages (login, register)
│ │ ├── dashboard/ # Dashboard pages (home, settings)
│ │ └── index.astro # Landing page
│ ├── styles/ # Global styles (Tailwind, CSS variables)
│ └── types/ # TypeScript types
├── data/ # SQLite database file
├── tailwind.config.js # Tailwind configuration
├── astro.config.mjs # Astro configuration
├── package.json # Project metadata and scripts
└── README.md # This file
- Clone the repository:
git clone <repository-url> cd Astro\ Template
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Build for production:
npm run build
- Passwords are hashed using SHA-256 before storage.
- Sessions are managed with secure tokens (stored in cookies and localStorage).
- All authentication and user data is stored in a local SQLite database (
data/database.sqlite). - Registration checks for duplicate emails.
- API endpoints return clear error messages for invalid credentials or duplicate users.
- Personalized welcome and statistics (total users, active users, new users, recent activities)
- Live data updates every 30 seconds
- User settings page (profile info, dark mode, notifications)
- Logout functionality
- Authentication
POST /api/auth/login— User loginPOST /api/auth/register— User registration
- Users
GET /api/users/users— Get all usersPOST /api/users/users— Create a new userPUT /api/users/users— Update a userDELETE /api/users/users— Delete a user
- Dashboard
GET /api/dashboard/home— Get dashboard statistics and recent activitiesGET /api/dashboard/settings— Get user settingsPUT /api/dashboard/settings— Update user settings
- Toast: Global notification system. Trigger with
window.showToast(message, type)or dispatch atoastevent. Supports success/error, auto-dismiss, and max visible toasts. - Dropdown: Flexible dropdown/select component. Supports icons, search, disabled/locked options, and custom triggers.
- Popup: Modal dialog with customizable content, close/back icons, and keyboard/mouse accessibility.
- Uses Tailwind CSS with custom CSS variables for colors, backgrounds, and borders.
- Dark mode is supported via the
.darkclass and can be toggled or set by user preference. - Utility classes for buttons, cards, inputs, badges, and more are defined in
src/styles/global.css.
- Custom 404 page with friendly messaging and a link back to the homepage.
npm run dev— Start the development servernpm run build— Build for productionnpm run preview— Preview the production build
MIT License
Copyright (c) 2024 Claw
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.