Skip to content

jinnyjiinlee/stcok-community-for-nestjs-education

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ Alice Stock Community

A Stock Community App for NestJS Learning & Tutorial Materials

This project was created as educational material for NestJS backend development course. It demonstrates modern web development practices with a Toss-inspired UI and real-time stock community features.

🎯 Project Overview

Alice Stock Community is a modern stock discussion platform inspired by popular fintech apps like Toss. Users can view real-time stock prices, charts, and participate in community discussions with automatic sentiment analysis.

πŸ“š Educational Purpose: This repository serves as comprehensive learning material for NestJS backend development, covering API design, data validation, real-time updates, and modern TypeScript patterns.

✨ Features

πŸ“Š Stock Information

  • Real-time stock price simulation (ALICE CORP)
  • Interactive price charts with Canvas API
  • NVIDIA-style bullish trend simulation
  • Live market statistics and trading volume

πŸ’¬ Smart Community

  • Real-time message posting and updates
  • Automatic sentiment analysis (bullish/bearish detection)
  • Live notifications for new community posts
  • Keyword-based mood indicators (πŸ“ˆ bullish, πŸ“‰ bearish)

🎨 Modern UI/UX

  • Toss-inspired design system
  • Clean white-based interface
  • Fully responsive mobile-first design
  • Smooth animations and micro-interactions

⚑ Technical Stack

Frontend

  • Vanilla JavaScript with modern ES6+ features
  • HTML5 Canvas for stock chart visualization
  • CSS3 with custom properties and modern layouts
  • Responsive Design with mobile-optimized breakpoints

Backend (NestJS)

  • NestJS Framework with TypeScript
  • REST API with proper HTTP methods
  • Data Validation using class-validator
  • In-memory storage (ready for database integration)
  • Sentiment Analysis with keyword detection
  • CORS enabled for frontend integration

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation & Setup

  1. Clone the repository

    git clone <your-repository-url>
    cd alice-stock-community
  2. Backend Setup

    cd backend
    npm install
    npm run start:dev

    Backend will run on http://localhost:3000

  3. Frontend Setup

    cd frontend
    # Simply open index.html in your browser
    # or use a local server:
    npx serve .

πŸ”§ API Endpoints

Method Endpoint Description
GET /messages Fetch all community messages
POST /messages Create a new community message

πŸ“ Request/Response Examples

POST /messages

{
  "nickname": "InvestorJoe",
  "text": "ALICE μ£Όκ°€ μƒμŠΉ μ˜ˆμƒ! πŸš€"
}

Response

{
  "id": "1691234567890abc",
  "nickname": "InvestorJoe",
  "text": "ALICE μ£Όκ°€ μƒμŠΉ μ˜ˆμƒ! πŸš€",
  "sentiment": "bullish",
  "createdAt": "2024-08-10T15:30:00.000Z"
}

πŸ“š Learning Objectives

This project covers essential NestJS concepts:

πŸŽ“ Backend Development

  • Project Structure - Understanding NestJS modular architecture
  • Controllers - Handling HTTP requests and responses
  • Services - Business logic separation and dependency injection
  • DTOs - Data validation and transformation
  • Modules - Feature-based code organization
  • Middleware - CORS, validation pipes, and error handling

πŸ›  Advanced Topics (Ready for Extension)

  • Database Integration - TypeORM or Prisma setup
  • Authentication - JWT and user management
  • Real-time Features - WebSocket implementation
  • External APIs - Stock data integration
  • Testing - Unit and integration tests
  • Deployment - Docker and cloud deployment

πŸ”¨ Project Structure

alice-stock-community/
β”œβ”€β”€ frontend/                 # Frontend application
β”‚   β”œβ”€β”€ index.html           # Main HTML file
β”‚   β”œβ”€β”€ style.css            # Toss-inspired styles
β”‚   └── script.js            # Stock app logic
β”œβ”€β”€ backend/                 # NestJS backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.ts          # Application entry point
β”‚   β”‚   β”œβ”€β”€ app.module.ts    # Root module
β”‚   β”‚   └── messages/        # Messages feature module
β”‚   β”‚       β”œβ”€β”€ messages.module.ts
β”‚   β”‚       β”œβ”€β”€ messages.controller.ts
β”‚   β”‚       β”œβ”€β”€ messages.service.ts
β”‚   β”‚       └── create-message.dto.ts
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
└── README.md

🎯 Key Features Explanation

πŸ’‘ Sentiment Analysis

The app automatically detects bullish/bearish sentiment using keyword matching:

  • Bullish keywords: "μƒμŠΉ", "였λ₯Έλ‹€", "맀수", "πŸš€", "πŸ“ˆ"
  • Bearish keywords: "ν•˜λ½", "λ–¨μ–΄", "맀도", "πŸ“‰", "πŸ’Έ"

πŸ“ˆ Stock Price Simulation

  • 70% chance of small gains (+0.2% ~ +1.7%)
  • 5% chance of big rallies (+2% ~ +8%)
  • 20% chance of sideways movement (Β±0.2%)
  • 5% chance of minor corrections (-0.8%)

πŸš€ Future Enhancements

  • Database integration (PostgreSQL/MongoDB)
  • Real stock API integration
  • User authentication system
  • WebSocket for real-time updates
  • Advanced sentiment analysis with AI
  • Mobile app development
  • Automated testing suite

🀝 Contributing

This is an educational project. Feel free to fork, experiment, and submit pull requests with improvements!

πŸ“„ License

This project is created for educational purposes. Feel free to use it for learning and teaching NestJS development.

πŸ™ Acknowledgments

  • Inspired by Toss and other modern fintech applications
  • Built with ❀️ for NestJS learning community
  • Special thanks to the NestJS team for the amazing framework

Happy Coding! πŸš€

This project demonstrates that learning backend development can be both practical and fun. Dive into the code, experiment with new features, and build your NestJS expertise!

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •