How nicknochnack/sourcery works
Project type and purpose
• This is a full-stack web application (“Sourcery”) that helps procurement teams generate, distribute, and evaluate RFPs (requests for proposals) using generative AI.
• The backend is an Express/Node.js API with Knex/SQL and Passport for auth; the frontend is a React/Vite SPA styled with Tailwind.
Main components
a. Frontend (client/)
• React SPA (client/src)
• UI components (client/src/ui), pages (client/src/pages), utilities for HTTP and auth (client/src/utilities)
• Bundler: Vite (client/vite.config.js), Tailwind (client/tailwind.config.js)
b. Backend API (server.js + api/ + controller/ + model/)
• API routes (api/*.js)
• Controllers (controller/*Controller.js) implement business logic
• Models (model/*.js) wrapping Knex queries
• Middleware (middleware/passport.js) for authentication
• Utilities (utilities/*.js) for helper functions
c. Database
• PostgreSQL accessed via Knex; schema migrations live in migrations/
d. File storage
• uploads/rfp-responses holds uploaded Excel files
e. External AI service
• IBM watsonx AI (api/watsonx.js + controller/watsonxController.js)
Relationships & data flow
• The browser (user) sends HTTP(S) requests to the React SPA.
• SPA makes AJAX calls to the Express API (client/src/utilities/api.js).
• Express API routes → controllers → models → database for CRUD on users, RFPs, vendors, proposals, responses, approvals.
• For generative assistance, controllers call the Watsonx client → receive AI responses → return to SPA.
• File uploads (RFP responses) stream from frontend into Express → saved to uploads/ → processed by controllers → metadata stored in the DB.
• Authentication requests (login/signup) pass through Passport middleware → JWT or session → protected routes via PrivateRoute in React.
Architectural patterns & design principles
• Layered/MVC pattern:
• Route Layer (api/)
• Controller Layer (controller/)
• Data Access Layer (models + migrations)
• Separation of concerns: auth middleware isolated, utilities factored out, UI components decoupled.
• Single Page Application for the client, RESTful API on the server.
• External service integration encapsulated in its own module (watsonx).
• Blue = application components
• Orange = database & storage
• Green = external AI service