A full-stack document management system that manages documents, users, and roles with role-based access control.
Each document defines access rights (which roles can access it) and tracks publication dates. Users are categorized by roles, and each user must have a defined role.
- Runtime: Node.js 22.x
- Framework: Express.js 4.x
- Database: MongoDB 7.0+ with Mongoose ODM
- Authentication: JWT with bcrypt
- Testing: Jasmine with Supertest
- Framework: React 16.x + Elm (hybrid architecture)
- State Management: Redux with redux-thunk
- Routing: React Router 4.x
- Build Tool: Webpack 4.x
- Testing: Jest + Enzyme for React, elm-test for Elm
- Package Manager: pnpm 10.x with workspaces
- Code Quality: ESLint, Biome formatter
- CI/CD: GitHub Actions
- Node.js 22.x
- pnpm 10.x
- MongoDB 7.0+
-
Clone the repository and navigate to the project folder:
git clone https://github.com/kevgathuku/docue-stack cd docue-stack -
Install all dependencies (from the root directory):
pnpm install
-
Set up environment variables for the backend:
cd backend cp .env.example .envEdit
backend/.envwith your configuration:PORT- Server port (default: 8000)SECRET- Secret key for JWT token encryptionMONGODB_URL- MongoDB connection URLNODE_ENV- Environment (development,test, orproduction)
-
Set up environment variables for the frontend:
cd ../frontend cp .env.example .envEdit
frontend/.envwith your configuration:NODE_ENV- Environment (development,test, orproduction)VITE_API_BASE_URL- Backend API URL (default:http://localhost:8000)
Run both backend and frontend in separate terminals:
# Terminal 1 - Backend (runs on port 8000)
pnpm --filter backend start
# Terminal 2 - Frontend (runs on port 3000, proxies API to backend)
pnpm --filter frontend startAccess the application at http://localhost:3000
# Backend only
pnpm --filter backend start
# Frontend only
pnpm --filter frontend start# Run all tests
pnpm test
# Backend tests only
pnpm --filter backend test:simple
# Frontend tests only
pnpm --filter frontend test
# Frontend Elm tests
pnpm --filter frontend test:elmFor advanced testing scenarios (parallel execution, custom databases), see backend/TESTING.md.
# Format all code with Biome
pnpm format
# Lint backend
pnpm --filter backend lint
# Lint and auto-fix backend
pnpm --filter backend lint:fixdocue-stack/
├── backend/ # Express.js API server
│ ├── server/
│ │ ├── config/ # Database and app configuration
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # Mongoose schemas
│ │ └── routes/ # API routes
│ ├── spec/ # Jasmine tests
│ └── migrations/ # Database migrations
├── frontend/ # React + Elm application
│ ├── src/ # React components and logic
│ ├── public/ # Static assets
│ ├── config/ # Webpack configuration
│ └── tests/ # Jest and Elm tests
└── .github/ # CI/CD workflows
The backend API runs on http://localhost:8000 and provides the following endpoints:
- Authentication:
/api/users/login,/api/users/logout - Users:
/api/users(CRUD operations) - Documents:
/api/documents(CRUD operations with role-based access) - Roles:
/api/roles(CRUD operations)
All authenticated endpoints require an x-access-token header with a valid JWT token.
This project can be deployed to Vercel. See DEPLOYMENT.md for detailed instructions.
Quick deploy:
# Install Vercel CLI
npm install -g vercel
# Deploy backend
cd backend && vercel --prod
# Deploy frontend
cd frontend && vercel --prodThis project uses GitHub Actions for CI/CD. Tests run automatically on:
- Push to
mainordevelopbranches - Pull requests to
mainordevelop
See .github/workflows/ for workflow configurations.
For detailed development guidelines, see:
- Create a feature branch from
develop - Make your changes with tests
- Ensure all tests pass:
pnpm test - Format code:
pnpm format - Submit a pull request to
develop
This project is licensed under the MIT License - see the LICENSE file for details.