Introduction to Earthworm
Earthworm is a fascinating project designed to assist users in learning English more effectively through the construction of sentences using conjunctions. This innovative approach helps bridge language barriers, making the learning process both enjoyable and efficient.
Getting Started
To embark on this learning journey with Earthworm, certain tools and environments are required to be properly set up. The instructions are primarily geared towards setting up the project in a local development environment.
Requirements
- pnpm: Ensure the installation of pnpm with a version of 8 or higher. Activation is as simple as executing
corepack enable
in the terminal. - Node.js: A Node.js version 20 or later is required. The project uses the version specified in its
.node-version
file. - Postgres and Redis: Versions 14.0.0+ for Postgres and 5.0.0+ for Redis are necessary for database and caching functionalities.
- Docker: This is essential for running containerized applications. Ensure it is successfully installed and functional on your system.
Setting Up the Environment
Dependency Installation
Begin by installing the necessary dependencies via the command:
pnpm install
Configuration Files
Configure the environment files by copying from provided examples. For the server:
cp ./apps/api/.env.example ./apps/api/.env
And similarly for the client application:
cp ./apps/client/.env.example ./apps/client/.env
Data Initialization
Unzip and prepare initial data for the Logto system:
unzip logto_db_init_data.zip -d .volumes/
Service Management via Docker
Start the project’s backend services, including Postgres and Redis, using Docker:
pnpm docker:start
Stop services when necessary using:
pnpm docker:stop
Database Schema Initialization
Initialize the database schema with:
pnpm db:init
Course Data Management
On first-time setup, create and upload course data:
pnpm db:upload
Starting the Services
Launch the backend service with:
pnpm dev:serve
And start the frontend service with:
pnpm dev:client
Testing the Project
Earthworm encourages rigorous testing before code submission to ensure quality.
Frontend Testing
Utilize Vitest and Cypress for testing front-end components:
cd apps/client
pnpm test:unit:run
pnpm test:e2e:run
Backend Testing
Jest is primarily used for backend tests, which involve accessing a test database:
cd apps/api
pnpm test
Documentation and Contributions
Earthworm’s documentation is structured and managed using Vitepress:
pnpm docs:dev
Contributions are welcome, with a growing community supporting its development.
Frequently Asked Questions
- Database Connection Issues: Double-check the
.env
file for any misconfigurations affecting database connectivity. - Course Data Updates: If course data requires updating, use:
pnpm db:update
- Installation Errors: Ensure the appropriate build environments are available for certain dependencies, especially argon2 on Windows, by installing necessary development tools.
Frontend Development Guidelines
- Avoid Destructuring the Pinia Store: Maintain clarity by referencing the store directly.
- Separate UI Logic: Keep UI logic out of composables for better testability and maintainability.
Earthworm is a dynamic and engaging project inviting learners and developers alike to contribute and refine a valuable language-learning resource. Join the community to further enhance this educational tool!