NodCord is a TypeScript service platform for Discord automation. The REST API is powered by Express.js, the integrated bot uses discord.js, and all persistence is handled through Prisma with a MySQL database. The goal is to provide a unified codebase so that the API, bot, and supporting tools all operate on the same data sources.
π‘ The application is currently migrating from older JavaScript/Mongoose components. New contributions should follow the TypeScript/Prisma stack described here.
- Features
- Technologies
- Installation
- Usage
- Testing & Quality Assurance
- Database & Prisma
- Configuration
- Documentation
- Contributing
- Security
- License
- REST API with a TypeScript controller layer and strongly typed responses
- Discord bot that shares services and database access through Prisma
- MySQL as the central data source (run locally via Docker or use a hosted instance)
- Modular structure (API, bot, client, Prisma seeds, scripts) for easy extensions
- Extensive project and migration documentation inside the
docs/directory - Enterprise-ready test layout (API, bot, and EJS views) including coverage reports and JUnit output
| Area | Stack |
|---|---|
| Runtime | Node.js β₯ 18 |
| Language | TypeScript (strict mode) |
| Framework | Express.js |
| Database | MySQL 8.x or compatible (MariaDB β₯ 10.6 verified) |
| ORM/Client | Prisma |
| Discord | discord.js |
| Tooling | ts-node-dev, Jest (multi-project), Supertest, Testing Library, Prettier, Prisma CLI |
- Node.js >= 18 and npm >= 9
- Running MySQL instance (e.g. Docker:
docker run --name nodcord-mysql -e MYSQL_ROOT_PASSWORD=secret -p 3306:3306 -d mysql:8) - Git
- Clone the repository:
git clone https://github.com/vectode/NodCord.git
- Enter the project directory:
cd NodCord - Install dependencies:
npm install
- Generate the Prisma Client (creates
node_modules/@prisma/clientbased on the schema):npx prisma generate
- Run the initial migration against your MySQL database:
npx prisma migrate deploy
- Start the development server:
npm run dev
Key npm scripts:
{
"dev": "ts-node-dev --respawn --transpile-only src/server.ts",
"build": "tsc --project tsconfig.json",
"start": "node dist/server.js",
"test": "jest --config jest.config.cjs",
"test:api": "jest --config jest.config.cjs --selectProjects api",
"test:bot": "jest --config jest.config.cjs --selectProjects bot",
"test:views": "jest --config jest.config.cjs --selectProjects views",
"test:coverage": "jest --config jest.config.cjs --coverage",
"test:ci": "npm run lint && npm run typecheck && npm run test:coverage",
"prisma:migrate": "prisma migrate deploy",
"prisma:studio": "prisma studio"
}npm run devstarts the server with hot reloading (ts-node-dev).npm run buildcreates adist/directory with compiled JS output.npm startlaunches the build in production mode.npm testexecutes all Jest projects (API, bot, views) together.npm run test:api|bot|viewsenables focused test runs per responsibility.npm run test:coverageproduces combined coverage reports (text,lcov,cobertura).npm run test:cichains linting, type checking, and coverage for CI/CD pipelines.npm run prisma:migratedeploys migrations to the configured database.npm run prisma:studioopens the Prisma Studio UI for data inspection.
The test landscape is based on a Jest multi-project configuration:
- API: Runs in the Node test environment and uses
supertest/nockto validate REST endpoints and external integrations. - Bot: Uses the Node environment so Discord-specific services can be tested in isolation through mocks.
- Views: Runs in the
jsdomenvironment and relies on@testing-library/jest-domto verify EJS templates and client-adjacent logic.
All projects share jest.setup.ts, which enables jest-extended and unifies the runtime environment. Test results are also exported as a JUnit file at reports/junit/jest-junit.xml, and coverage reports are collected inside coverage/.
π‘ Run
npm run test:watch -- --selectProjects apito start any area in watch mode.
The Prisma schema lives at prisma/schema.prisma. It defines all models (e.g. users, roles, projects) and describes relations plus constraints for MySQL. Additional tips:
- Create a
.envfile at the project root and defineDATABASE_URL, e.g.mysql://user:password@localhost:3306/nodcord. - Use
npx prisma db pushwhen you want to sync the schema quickly during development. - Run seeds through
prisma db seed; they rely on files insideprisma/seeds/.
- Create a
.envfile in the project root (or populate the version provided by your secrets management system). - Provide the variables required from the following categories:
- Core runtime:
VERSION,NODE_ENV,SERVER_NAME,LOG_LEVEL,TZ - Server & API:
PORT,BASE_URL,API_HTTPS,API_BASE_URL,API_PORT - Databases:
DATABASE_URL,MONGO_URI - Security & monitoring:
SESSION_SECRET,JWT_SECRET,JWT_SESSION_SECRET,SENTRY_AUTH_TOKEN - Client routing:
CLIENT_HTTPS,CLIENT_BASE_URL,CLIENT_PORT - Discord & bot:
DISCORD_*,BOT_ACTIVITY_*,OWNER_ID - OAuth:
GOOGLE_*,GITHUB_*,LINKEDIN_* - Payments:
STRIPE_SECRET_KEY,PAYPAL_CLIENT_* - Mail & contact:
SMTP_*,CONTACT_EMAIL,CONTACT_SMTP_* - Infrastructure:
TS_*
- Core runtime:
Further explanations live in the module-specific files under src/config/ and in the reference documentation under docs/.
Detailed architecture notes, installation guides, roadmaps, and process descriptions live inside docs/. Key entry points:
docs/guides/β Installation, FAQ, and support guidesdocs/overview/β Architecture, components, and data flowsdocs/planning/β Migration plans toward full Prisma adoptiondocs/reference/β Technical references and workflowsdocs/process/β Contributing, release, and change management
Contributions are welcome! Please read CONTRIBUTING.md before opening pull requests. It covers the branch strategy, TypeScript coding guidelines, and how to manage Prisma migrations.
Security-relevant information can be found in SECURITY.md. Report vulnerabilities confidentially so that we can secure the MySQL/Prisma infrastructure quickly.
This project is licensed under the MIT License. See the LICENSE file for details.

