This guide covers everything you need to know for developing and contributing to Resource Tracker.
- Node.js 22+ and npm
- Git for version control
- Discord Developer Account for OAuth testing
- Turso Account for database (free tier available)
To contribute to the project, you should first create your own copy (a "fork") of the repository on GitHub.
-
Fork the Repository: Click the Fork button at the top-right of the main project's GitHub page. This will create a copy of the repository under your own GitHub account.
-
Clone Your Fork: Clone the repository from your account to your local machine. Replace
YOUR_USERNAMEwith your GitHub username.git clone https://github.com/YOUR_USERNAME/ResourceTracker.git cd ResourceTracker -
Install Dependencies:
npm install
Copy .env.example to .env.local and fill in the required values. See ENVIRONMENT.md for detailed instructions.
# Required for development
DISCORD_CLIENT_ID=your_test_app_client_id
DISCORD_CLIENT_SECRET=your_test_app_secret
DISCORD_GUILD_ID=your_test_server_id
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=a_random_string_for_session_encryption
TURSO_DATABASE_URL=your_dev_database_url
TURSO_AUTH_TOKEN=your_dev_auth_token
# A comprehensive role configuration example
DISCORD_ROLES_CONFIG=[{"id":"your_admin_role_id","name":"Administrator","level":100,"isAdmin":true,"canManageUsers":true,"canEditTargets":true,"canAccessResources":true,"canExportData":true},{"id":"your_logistics_manager_role_id","name":"Logistics Manager","level":50,"isAdmin":false,"canManageUsers":false,"canEditTargets":true,"canAccessResources":true,"canExportData":false},{"id":"your_contributor_role_id","name":"Contributor","level":1,"isAdmin":false,"canManageUsers":false,"canEditTargets":false,"canAccessResources":true,"canExportData":false}]
# Optional branding
NEXT_PUBLIC_ORG_NAME=Dev Test Community# Apply the latest database schema
npm run db:push
# Populate the database with sample data
npm run populate-resourcesnpm run dev
# App will be available at http://localhost:3000ResourceTracker/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ ├── components/ # React components
│ ├── dashboard/ # Dashboard pages
│ └── resources/ # Resource management pages
├── lib/ # Shared utilities
│ ├── auth.ts # NextAuth configuration
│ ├── db.ts # Database schema
│ └── discord-roles.ts # Role management
├── scripts/ # Database and utility scripts
├── docs/ # Documentation
└── drizzle/ # Database migrations
- Create a feature branch:
git checkout -b feature/new-feature-name - Make changes and test locally with
npm run dev. - Ensure code quality by running
npm run lint. - Verify the production build with
npm run build.
- Modify the schema in
lib/db.ts. - Generate a migration file:
npm run db:generate. - Apply the migration to your local database:
npm run db:push.
- Authentication: Test the full sign-in flow with different Discord roles.
- Permissions: Verify that role-based access control is enforced correctly on API routes and UI components.
- Responsiveness: Check the UI on mobile, tablet, and desktop viewports, in both light and dark themes.
- Error Handling: Test edge cases like invalid inputs, network failures, and insufficient permissions.
- Double-check your Discord application configuration in the developer portal.
- Verify that the redirect URI in your Discord app settings matches
NEXTAUTH_URLexactly. - Ensure all required environment variables in
.env.localare correctly set. - Use your browser's developer tools to check for console errors or failed network requests.
- Verify your Turso database URL and auth token are correct.
- Check for errors in the terminal during schema migration (
db:push). - Use the Turso CLI (
turso db shell <db_name>) for direct database access to inspect data.
- Validate that
DISCORD_ROLES_CONFIGis a valid, single-line JSON string. - Ensure the role IDs in your configuration match the actual role IDs from your Discord server.
- Check that the test user has the intended roles assigned in Discord.
- TypeScript: Adhere to strict type checking. Document complex functions and types.
- React: Use functional components with hooks. Implement clear loading and error states.
- API Routes: Validate all incoming data. Use consistent error responses and appropriate HTTP status codes.
See CONTRIBUTING.md for detailed contribution guidelines.
- Create a feature branch from an up-to-date
main. - Develop the feature and include tests where applicable.
- Update all relevant documentation (
/docs,README.md). - Submit a pull request and describe your changes clearly.
- Address any feedback from the code review.
The application is designed for easy deployment on Vercel.
- Connect your GitHub repository to a new Vercel project.
- Configure the same environment variables you used for development, but with production values.
- Vercel will automatically build and deploy the application on every push to the
mainbranch.
See the root README.md for a more detailed deployment guide.