This is the backend service for the repo-viewer application. It is built with Node.js and TypeScript, providing API endpoints and data processing for the frontend viewer.
- RESTful API server
- SQLite database integration
- Modular processing pipeline
- TypeScript for type safety
- Easily extensible architecture
- Node.js (v16 or later recommended)
- npm (comes with Node.js)
- Clone the repository:
git clone <repo-url> cd backend
- Install dependencies:
npm install
- Source code is in the
src/directory. - To build the project:
npm run build
- To start the server (after building):
npm start
- For development with auto-reload:
npm run dev
Once the backend is up and running, you can send the filepath of the repository on your machine that you want to analyse via the viewer-frontend app.
The filepath of the project to analyse should be given relative to the location of this repo.
backend/
├── build/ # Compiled JavaScript output
│ ├── app.js
│ ├── db.js
│ ├── server.js
│ ├── types.js
│ └── process/
│ ├── file.js
│ ├── filter.js
│ ├── index.js
│ └── morph.js
├── data/ # Application data (ignored by git)
│ ├── app.db
│ └── tree.json
├── src/ # TypeScript source code
│ ├── app.ts
│ ├── db.ts
│ ├── server.ts
│ ├── types.ts
│ └── process/
│ ├── file.ts
│ ├── filter.ts
│ ├── index.ts
│ └── morph.ts
│ └── schema/
│ └── schema.sql
├── package.json # Project metadata and dependencies
├── tsconfig.json # TypeScript configuration
└── .gitignore # Git ignore rules
- The backend uses SQLite for data storage.
- The database file is located at
data/app.db. - The schema is defined in
src/schema/schema.sql.
npm run build— Compile TypeScript to JavaScriptnpm start— Start the compiled servernpm run dev— Start the server with auto-reload (requiresnodemon)
When up and running, this app exposes a single endpoint which runs the application logic. This endpoint receives the filepath of a repository relative to the root of this directory, and uses the tsconfig of that repository as the entry point for analysis.
The graph of the project is stored in app.db, and a JSON file representing the project is stored in tree.json
The return type of the endpoint is a D3ForceTree.