A web application for generating project codes in PFEPL format with document upload capability.
- Project Selection: Choose from a dropdown of available projects
- Code Generation: Generate codes in the format
PFEPL/YY-YY/PROJECT_CODE/XXXX - Document Upload: Upload related documents after code generation
- Modern UI: Clean, responsive interface with gradient backgrounds
The generated codes follow this format:
- PFEPL: Constant prefix
- YY-YY: Financial year (auto-calculated based on current date)
- PROJECT_CODE: Selected project code from dropdown
- XXXX: Incremental number (0001, 0002, etc.)
Example: PFEPL/25-26/UVRILP/0001
- Node.js (version 14 or higher)
- npm or yarn
-
Install dependencies:
npm install
-
Create an .env file in the project root:
MYSQL_HOST=127.0.0.1 MYSQL_PORT=3306 MYSQL_USER=root MYSQL_PASSWORD=your_password_here MYSQL_DATABASE=code_genrator
-
Start the backend server:
npm start
This will start the Express server on port 3001.
-
Start the frontend development server (in a new terminal):
npm run dev
This will start the Vite development server on port 5173.
-
Access the application: Open your browser and navigate to
http://localhost:5173
-
Generate Code:
- Select a project from the dropdown
- Enter a reason for generation
- Click "Generate Code"
- The system will display the generated code
-
Upload Document:
- After generating a code, you can upload a related document
- Click "Choose file to upload" and select your document
- Click "Upload Document" to attach it to the generated code
The application comes with pre-loaded sample projects:
- Urban Village Infrastructure (UVRILP)
- Smart City Development (SCD)
- Digital Transformation (DIGIT)
- Green Energy Initiative (GEI)
- Healthcare Modernization (HCM)
- Express.js server with SQLite database
- RESTful API endpoints for projects, code generation, and file uploads
- Multer for handling file uploads
- CORS enabled for frontend communication
- React 18 with functional components and hooks
- Vite for fast development and building
- Modern CSS with gradients and animations
- Responsive design that works on all devices
- projects: Stores project information (name, code)
- generated_codes: Stores generated codes with metadata and document paths
GET /api/projects- Get all available projectsPOST /api/generate-code- Generate a new codePOST /api/upload-document- Upload a document for a generated code
├── src/
│ ├── components/
│ │ └── CodeGenerator.jsx
│ ├── App.jsx
│ ├── main.jsx
│ └── index.css
├── database.js
├── server.js
├── package.json
├── vite.config.js
└── README.md
To modify the application:
- Add new projects: Edit the
insertSampleProjects()function indatabase.js - Modify code format: Update the code generation logic in
server.js - Change UI: Modify the React components in
src/components/ - Update styling: Edit
src/index.css
-
Build the frontend:
npm run build
-
Serve static files: Update
server.jsto serve the built files from thedistdirectory -
Set environment variables: Configure production database and file storage paths
This project is open source and available under the MIT License.