The Backend handles API requests, processes data, and serves chart information to the frontend.
Built with Node.js, Express, Babel, MongoDB, and PostgreSQL via Sequelize, it acts as the bridge between the data collector and the frontend.
See frontend β | See data collector β
π Want to contribute?
We welcome collaborators who wish to contribute and help enhance this trading tool. Feel free to reach out to the maintainers to get involved.
β οΈ Important: Make sure you follow the existing project structure
- /src
- /adapters: data access layer (DBs, APIs, external services)
- /controllers: Express routes, organized by module
- /fixtures: mock or fixture data
- _/managers: business logic layer β sits between controllers and adapters, handling data processing and coordination
- /assets: static public assets (images, CSS, client JS)
- /config: configuration files
- /docs: API and documentation files
- /scripts: helper or automation scripts
- /scripts/install: setup/installation scripts
- /tests: test files
Trader Charts Project is based on Nodejs, and use Sequelize to be able to connect to a PostgreSQL database.
It supports several database connections, SQL and mongodb, local and cloud databases.
-
Install dependencies
$ npm ci
- Adding AppRouter
- Adding UploadRouter
- Adding PhotoRouter
- Adding UsersRouter
- Adding NegotiableInstrumentTypesRouter
- Adding IndicatorsRouter
- Adding AlertConditionExpressionsRouter
- Adding AlertConditionOperationsRouter
- Adding NegotiableInstrumentsRouter
- Adding BymaStocksDataRouter
- Adding AlertsTargetNegotiableInstrumentsRouter
- Adding API UI Endpoints
- Adding API Documentation
- Add SQL logger
- Adding RssFeedsDataRouter, including sentiment analysis and topics
- Add Application logger
- Adding HTTP Requests logger
- Adding Code Validation & Linting
- Adding Code Auto-Formatting
This project supports SQL and MongoDB databases.
To use them, you must either install the database locally or use a cloud solution like MongoDB Atlas or AWS.
After that, configure the required environment variables.
There are three environments: development, development with fixtures, and production.
-
Development with Mocked Database
You just need to create an empty database. All tables and basic example data will be automatically installed at runtime.
To run the mocked database environment:npm run start-mock -
Development
Database tables and structure will be created automatically. No fixture data will be inserted.
To run the development environment:npm run start-dev -
Production
No data is set up automatically. You must create all tables and insert data manually.
To run the production environment:npm run start
You can interact with the API using tools like Postman, or via Trader Charts API. We use Swagger for testing API endpoints and generating the API specification, and Redoc for a clean, readable API documentation.
Before using the API, run the following command to generate the necessary Swagger API files:
npm run generate-swagger-api-
API Endpoints
-
Access directly at Trader Charts API
-
-
API Specifications
- View the Swagger 2.0 spec
- View the OpenAPI 3.0 spec
-
API Documentation
-
Explore a clear API documentation at Trader Charts Documentation
-
There are three main options for testing the project:
- Access the Trader Charts API and make API calls directly using the "Execute" feature in the API Endpoints.
- Run Postman or any other similar tool for making calls.
- Run Frontend to test the integration with the project
β οΈ Important: When adding new endpoints, make sure to update the corresponding endpoint files and verify that all previous endpoints are still available in the documentation
- Run the following command to generate documentation including all new endpoints:
npm run generate-swagger-api
-
Copy the runtime files only after verifying your endpoints locally. This is crucial to ensure the schemas appear correctly in Redoc.
-
After testing, replace the default specification files with the runtime versions by renaming them:
- Rename
swagger_runtime.jsontoswagger_default.json(overwrites the default file) - Rename
swagger_runtime_v3.jsontoswagger_default_v3.json(overwrites the default file)
These variables are shared across all environments.
π Note: You only need to include the variables for the database you are using (SQL or MongoDB).
DB_HOST=[string]
DB_NAME=[string]
DB_PORT=[number]
DB_USER=[string]
DB_PASS=[string]
DB_SSL=true
DB_DIALECT=mongodb # Use MongoDB instead of SQL ['mongodb', 'sql]
ATLAS_URI=[string] # MongoDB Atlas cloud URI
MONGODB_URI=[string] # Local/other MongoDB URI
Create .env.development.local file:
# + include all common variables
Create .env.production file:
NODE_PATH=./src
NODE_ENV='production'
# + include all common variables
Thanks goes to these wonderful people:
Gonzalo |

