Database Setup
PostgreSQL Setup
-
Create Database
CREATE DATABASE onmarket_db; CREATE USER onmarket_user WITH ENCRYPTED PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE onmarket_db TO onmarket_user; -
Database Models The application uses Sequelize ORM with auto-sync. Models include:
-
store- Store information -
user_info- User profiles -
product- Product catalog -
cart- Shopping carts -
store_order- Orders -
balance_mutation- Financial transactions -
affiliate_account- Affiliate accounts -
affiliate_commissions- Commission records -
address_list- Delivery addresses -
bank_info- Bank account information -
review- Product reviews -
voucher- Discount vouchers - And many more...
-
-
Initial Data
- Categories
- Expedition methods
- Bank configurations
- Commission rates
MongoDB Setup
-
Start MongoDB
mongod --dbpath /path/to/data/directory -
Collections MongoDB is used for:
-
store_chat- Chat messages -
store_chat_room- Chat rooms -
affiliate_category- Affiliate categories -
affiliate_clicks- Click tracking -
affiliate_links- Affiliate link management -
order_info_cached- Order cache -
shipping_info_cached- Shipping cache -
price_info_cached- Price cache -
expedition_count- Delivery statistics
-
Redis Setup
-
Start Redis
redis-server -
Usage Redis is used for:
- Session management
- API response caching
- Rate limiting
- Bull queue jobs