AppFlowy/frontend/appflowy_web_app
2024-06-10 16:40:16 +08:00
..
cypress chore: improve coverage of cypress (#5483) 2024-06-06 19:47:14 +08:00
public chore: web and tauri project (#4996) 2024-04-03 19:25:54 +08:00
scripts feat: improve test coverage (#5481) 2024-06-06 17:48:58 +08:00
src chore: support openai chat on web 2024-06-10 16:40:16 +08:00
src-tauri fix: search improvements (#5473) 2024-06-05 13:44:32 +02:00
tailwind feat: support web layout setting and breadcrumbs (#5425) 2024-05-29 10:17:50 +08:00
.eslintignore feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
.eslintignore.web feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
.eslintrc.cjs chore: web and tauri project (#4996) 2024-04-03 19:25:54 +08:00
.gitignore feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
.nycrc feat: improve test coverage (#5481) 2024-06-06 17:48:58 +08:00
.prettierrc.cjs chore: web and tauri project (#4996) 2024-04-03 19:25:54 +08:00
beta.env chore: web build size optimization (#5071) 2024-04-08 20:09:15 +08:00
cypress.config.ts feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
Dockerfile feat: support server render html (#5471) 2024-06-05 14:08:19 +08:00
index.html feat: support server render html (#5471) 2024-06-05 14:08:19 +08:00
jest.config.cjs feat: improve test coverage (#5481) 2024-06-06 17:48:58 +08:00
nginx.conf feat: support server render html (#5471) 2024-06-05 14:08:19 +08:00
package.json chore: support openai chat on web 2024-06-10 16:40:16 +08:00
pnpm-lock.yaml chore: support openai chat on web 2024-06-10 16:40:16 +08:00
postcss.config.cjs chore: web and tauri project (#4996) 2024-04-03 19:25:54 +08:00
README.md chore: support openai chat on web 2024-06-10 16:40:16 +08:00
server.cjs feat: support server render html (#5471) 2024-06-05 14:08:19 +08:00
start.sh feat: support server render html (#5471) 2024-06-05 14:08:19 +08:00
tailwind.config.cjs chore: support openai chat on web 2024-06-10 16:40:16 +08:00
test.env chore: web build size optimization (#5071) 2024-04-08 20:09:15 +08:00
tsconfig.json feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
tsconfig.node.json feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
tsconfig.web.json feat: support document apply remote events (#5436) 2024-06-03 11:20:45 +08:00
vite.config.ts chore: improve coverage of cypress (#5483) 2024-06-06 19:47:14 +08:00

AppFlowy Web

🌟 Introduction

Welcome to the AppFlowy Web project! This project aims to bring the powerful features of AppFlowy to the web. Whether you're a developer looking to contribute or a user eager to try out the latest features, this guide will help you get started.

AppFlowy Web is built with the following technologies:

  • React: A JavaScript library for building user interfaces.
  • TypeScript: A typed superset of JavaScript that compiles to plain JavaScript.
  • Bun: A fast all-in-one JavaScript runtime.
  • Nginx: A high-performance web server.
  • Docker: A platform to develop, ship, and run applications in containers.

Resource Sharing

To maintain consistency across different platforms, the Web project shares i18n translation files and Icons with the Flutter project. This ensures a unified user experience and reduces duplication of effort in maintaining these resources.

  • i18n Translation Files: The translation files are shared to provide a consistent localization experience across both Web and Flutter applications. The path to the translation files is frontend/resources/translations/.

    The translation files are stored in JSON format and contain translations for different languages. The files are named according to the language code (e.g., en.json for English, es.json for Spanish, etc.).

  • Icons: The icon set used in the Web project is the same as the one used in the Flutter project, ensuring visual consistency. The icons are stored in the frontend/resources/flowy_icons/ directory.

Let's dive in and get the project up and running! 🚀

🛠 Getting Started

Prerequisites

Before you begin, make sure you have the following installed on your system:

  • Node.js (v18.6.0) 🌳
  • pnpm (package manager) 📦
  • Jest (testing framework) 🃏
  • Cypress (end-to-end testing) 🧪

Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/AppFlowy-IO/AppFlowy.git
cd frontend/appflowy_web_app

Install Dependencies

Install the required dependencies using pnpm:

## ensure you have pnpm installed, if not run the following command
# npm install -g pnpm@8.5.0

pnpm install

Start the Development Server

To start the development server, run the following command:

pnpm run dev

🚀 Building for Production(Optional)

if you want to run the production build, use the following commands

pnpm run build
pnpm run start

This will start the application in development mode. Open http://localhost:3000 to view it in the browser.

🧪 Running Tests

Unit Tests

We use Jest for running unit tests. To run the tests, use the following command:

pnpm run test:unit

This will execute all the unit tests in the project and provide a summary of the results.

Components Tests

We use Cypress for end-to-end testing. To run the Cypress tests, use the following command:

pnpm run cypress:open

This will open the Cypress Test Runner where you can run your end-to-end tests. 🧪

Alternatively, to run Cypress tests in the headless mode, use:

pnpm run test:components

Both commands will provide detailed test results and generate a code coverage report.

🔄 Development Workflow

Linting

To maintain code quality, we use ESLint. To run the linter and fix any linting errors, use the following command:

pnpm run lint

🚀 Production Deployment

Our production deployment process is automated using GitHub Actions. The process involves:

  1. Setting up an AWS EC2 instance: We use an EC2 instance to host the application.
  2. Installing Docker and Docker Compose: Docker is installed on the AWS instance.
  3. Configuring SSH Access: SSH access is set up with a user and password.
  4. Preparing Project Configuration: We configure Dockerfile, nginx.conf, and server.cjs in the web project.
  5. Using GitHub Actions: We use the easingthemes/ssh-deploy@main action to deploy the project to the remote server.

The deployment steps include building the Docker image and running the Docker container with the necessary port mappings:

docker build -t appflowy-web-app .
docker rm -f appflowy-web-app || true
docker run -d -p 80:80 -p 443:443 --name appflowy-web-app appflowy-web-app

The Web server runs on Bun. For more details about Bun, please refer to the Bun documentation.