Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Real-time web chat application built with a modern tech stack: Node.js, Express, React, Redux, TypeScript, and WebSockets.

NotificationsYou must be signed in to change notification settings

oliviacarlisle/YapChat

Repository files navigation

TypeScriptReactReduxExpress.jsMongoDBWebSocket

License: MITNode Version

📋 Overview

A modern, full-stack real-time chat application built with TypeScript, featuring instant messaging capabilities powered by WebSockets. This application demonstrates best practices in modern web development with a React frontend and Express backend.

✨ Features

  • Real-time Messaging: Instant message delivery using WebSocket connections
  • Modern UI: Clean and responsive interface built with React
  • State Management: Centralized state management with Redux Toolkit
  • Type Safety: Full TypeScript implementation for better developer experience
  • Database Persistence: Message history stored in MongoDB
  • Hot Reloading: Development environment with live reload for both client and server
  • Production Ready: Optimized build configurations for deployment

🛠️ Tech Stack

Frontend

  • React 18 - UI library
  • Redux Toolkit - State management
  • TypeScript - Type safety
  • Webpack 5 - Module bundler
  • Babel - JavaScript compiler

Backend

  • Node.js - Runtime environment
  • Express - Web framework
  • WebSocket (ws) - Real-time communication
  • MongoDB/Mongoose - Database and ODM
  • TypeScript - Type safety

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • Jest - Testing framework
  • Nodemon - Development server

📦 Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v16.0.0 or higher)
  • npm (v7.0.0 or higher)
  • MongoDB (v4.4 or higher)

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/yourusername/chat-application.gitcd chat-application

2. Install Dependencies

npm install

3. Environment Setup

Create a.env file in the root directory:

# Server ConfigurationPORT=3000NODE_ENV=development# Database ConfigurationMONGODB_URI=mongodb://localhost:27017/chat-app# WebSocket ConfigurationWS_PORT=8080# Client ConfigurationREACT_APP_API_URL=http://localhost:3000REACT_APP_WS_URL=ws://localhost:8080

4. Start MongoDB

Make sure MongoDB is running on your system:

# macOS/Linuxmongod# Windowsmongod.exe

💻 Development

Running the Application

To run both client and server in development mode:

# Terminal 1 - Start the TypeScript compiler for the servernpm run dev:server# Terminal 2 - Start the server with nodemonnpm run server# Terminal 3 - Start the client development servernpm run client

The application will be available at:

  • Frontend:http://localhost:8080
  • Backend API:http://localhost:3000
  • WebSocket:ws://localhost:8080

Available Scripts

# Start production servernpm start# Development serversnpm run server# Start server with nodemonnpm run client# Start client dev servernpm run dev:server# Watch and compile server TypeScript# Build commandsnpm run build:client# Build client for productionnpm run build:server# Compile server TypeScript# Code qualitynpm run lint# Run ESLintnpmtest# Run tests (when configured)

📁 Project Structure

chat-application/├── client/                 # Frontend application│   ├── src/               # Source files│   │   ├── components/    # React components│   │   ├── store/         # Redux store and slices│   │   ├── utils/         # Utility functions│   │   └── index.tsx      # Entry point│   ├── tsconfig.json      # TypeScript config│   └── webpack.config.js  # Webpack configuration│├── server/                # Backend application│   ├── src/              # Source files│   │   ├── controllers/  # Route controllers│   │   ├── models/       # Database models│   │   ├── routes/       # API routes│   │   ├── services/     # Business logic│   │   ├── utils/        # Utility functions│   │   └── server.ts     # Entry point│   └── tsconfig.json     # TypeScript config│├── types/                # Shared TypeScript types├── .vscode/              # VS Code settings├── eslint.config.js      # ESLint configuration├── package.json          # Project dependencies└── README.md            # Project documentation

⚙️ Configuration

VS Code Settings

For proper ESLint integration with VS Code, ensure your.vscode/settings.json includes:

{"eslint.experimental.useFlatConfig":true}

This is required for ESLint's new flat config system as of April 2024. SeeESLint's migration guide for more information.

TypeScript Configuration

The project uses separate TypeScript configurations for client and server to optimize for their respective environments.

🏗️ Building for Production

Build the Client

npm run build:client

This creates an optimized production build inclient/dist/.

Build the Server

npm run build:server

This compiles TypeScript files to JavaScript inserver/dist/.

Run in Production

NODE_ENV=production npm start

🧪 Testing

npmtest

Note: Test configuration is pending. Jest is installed and ready for test implementation.

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Code Style

  • Follow the ESLint configuration
  • Use Prettier for code formatting
  • Write meaningful commit messages
  • Add appropriate TypeScript types
  • Comment complex logic

📄 License

This project is licensed under the MIT License - see theLICENSE file for details.

👤 Author

Olivia Carlisle

🙏 Acknowledgments

  • Built with modern web technologies
  • Inspired by best practices in full-stack development
  • Special thanks to the open-source community

Made with ❤️ by Olivia Carlisle

About

Real-time web chat application built with a modern tech stack: Node.js, Express, React, Redux, TypeScript, and WebSockets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp