main
RFID-CP - RFID Card Management System
A modern web application for managing RFID cards and member access control built with Svelte 5, PostgreSQL, and Drizzle ORM.
Features
- 🔐 Admin Authentication: Secure login system for administrators
- 👥 Member Management: Create and manage member profiles
- 🆔 RFID Card Management: Track and assign RFID cards to members
- 📱 Web NFC Integration: Scan RFID cards directly from browsers that support Web NFC
- 🎨 Modern UI: Built with Shadcn/ui components and Tailwind CSS
- 🌍 Internationalization: Multi-language support with Paraglide JS
- 📊 Dashboard: Overview of system statistics and recent activity
Quick Start
Prerequisites
- Node.js 18+
- PostgreSQL database
- npm or yarn
Installation
- Clone the repository:
git clone <repository-url>
cd rfid-cp
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
Edit .env and configure your database connection:
DATABASE_URL="postgresql://username:password@localhost:5432/rfid_cp"
- Set up the database:
# Push schema to database
npm run db:push
# Run migrations (if needed)
npm run db:migrate
- Seed the database with initial data:
npm run db:seed
This will create:
- An admin user with credentials:
admin/admin123 - Sample members, RFID cards, and assignments
- Sample devices
- Start the development server:
npm run dev
The application will be available at http://localhost:5173.
Database Seeding
The seeder script creates initial data for development and testing:
npm run db:seed
What gets seeded:
- Admin User:
admin/admin123 - Sample Members: Max Mustermann, Anna Schmidt, Peter Müller
- RFID Cards: Various cards with different statuses (NEW, ENGRAVED)
- Assignments: Cards assigned to members
- Devices: RFID scanner and lock system devices
Available Scripts
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run check- Type checkingnpm run lint- Lint codenpm run format- Format codenpm run db:push- Push schema to databasenpm run db:migrate- Run migrationsnpm run db:studio- Open Drizzle Studionpm run db:seed- Seed database with initial data
Project Structure
src/
├── lib/
│ ├── components/ # Reusable UI components
│ ├── server/ # Server-side utilities
│ └── utils/ # Utility functions
├── routes/ # SvelteKit routes
│ ├── admin/ # Admin panel routes
│ └── api/ # API routes
├── schemas/ # Database schemas and validation
└── rpc-routes/ # RPC route handlers
scripts/
└── seed.ts # Database seeding script
drizzle/ # Database migrations
Technology Stack
- Frontend: Svelte 5, SvelteKit
- Styling: Tailwind CSS, Shadcn/ui
- Database: PostgreSQL with Drizzle ORM
- Authentication: Argon2 password hashing
- Internationalization: Paraglide JS
- Forms: SvelteKit Superforms
- Icons: Lucide Svelte
Development
Database Schema
The database schema is defined in src/schemas/database/schema.ts using Drizzle ORM. Key entities:
managementUsers- Admin usersmembers- System membersrfidCards- RFID card inventorymemberRfidCards- Card-to-member assignmentsdevices- RFID scanners and lock systemsaccessLogs- Access event loggingsystemLogs- System event logging
Web NFC Support
The application includes Web NFC integration for scanning RFID cards directly in supported browsers. The feature gracefully degrades when Web NFC is not available.
Internationalization
The app supports multiple languages using Paraglide JS. Translation files are located in the messages/ directory.
License
[Add your license here]
Description
Languages
Svelte
61.1%
TypeScript
37.6%
CSS
0.8%
JavaScript
0.4%
Dockerfile
0.1%