Robocoin V3 is a versatile web application designed for creating and managing community-based virtual economies. Built with Next.js and Prisma, it provides a robust platform for handling virtual currencies, user inventories, and marketplaces within specific groups or events, referred to as "camps".
- Multi-Camp Architecture: Create isolated environments ("camps"), each with its own user base, currency, and marketplace.
- Role-Based Access Control:
- Managers: Can create new camps and assign camp managers.
- Admins: Manage users, items, and settings within a specific camp.
- Users: Can own currency, trade items, and participate in the camp's economy.
- Virtual Currency System: Full support for user balances, direct user-to-user transfers, and transaction logging.
- Item Marketplace: An in-camp marketplace where users can list, buy, and sell virtual items.
- User Inventories: Users have a personal inventory to manage the items they own.
- Achievement System: Award achievements to users for reaching milestones or completing tasks.
- REST API: A comprehensive API for programmatic interaction with the application's resources.
- Framework: Next.js
- Language: TypeScript
- ORM: Prisma
- Database: MySQL / MariaDB
- Authentication: NextAuth.js
- Styling: Tailwind CSS
- API Documentation: Swagger UI
- Data Fetching: SWR
- Form Management: React Hook Form
- Schema Validation: Zod
Follow these instructions to get a local development environment up and running.
git clone https://github.com/RoboticsBrno/RoboCoin.git
cd RoboCoinInstall the project dependencies using npm:
npm installCopy the example environment file to create your local configuration:
cp .example-env .envNow, open .env and configure the following variables:
DATABASE_URL: Your MySQL/MariaDB connection string.- Format:
mysql://USER:PASSWORD@HOST:PORT/DATABASE
- Format:
NEXTAUTH_SECRET: A random string used to hash tokens. Generate one with:openssl rand -base64 32
NEXTAUTH_URL: The full URL of your development server.- Example:
http://localhost:3000
- Example:
Apply the database schema and generate the Prisma Client:
npx prisma migrate dev
npx prisma generateStart the Next.js development server:
npm run devThe application will be available at http://localhost:3000.
npm run dev: Starts the development server.npm run build: Creates a production-ready build of the application.npm run start: Starts the production server (requires a build first).npm run lint: Lints the codebase using ESLint.
This project uses Prettier for code formatting. A shell script is provided for convenience.
./format.shThe application automatically generates API documentation from the backend routes. Once the development server is running, you can access the Swagger UI at /api-docs.
For detailed instructions on deploying the application to a production environment (e.g., a Linux server with MariaDB), please refer to the DEPLOY.md guide.