This project is a clone of Dev.to, an open-source platform for developers to share articles, discuss topics, and build a community. The project consists of two main parts:
- Frontend: The user-facing interface of the platform, built with Next.js.
- Backend: The server-side logic, written in TypeScript, including APIs, database interactions, and business logic. Jest is used for testing the backend. The backend uses OAuth for authentication and SQLite as the database for storing data.
Deployment is handled using Docker, and the application is deployed to Vercel. Continuous Integration and Continuous Deployment (CI/CD) pipelines are implemented using GitHub Actions to automate the deployment process to Vercel.
Each part is a standalone application and runs independently. Below are the setup and usage instructions for both the frontend and backend.
- Frontend Setup
- Backend Setup
- Running the Applications
- Deployment
- Directory Structure
- Contributing
- License
- Clone the repository:
git clone https://github.com/your-repo/dev-to-clone.git
- Navigate to the frontend directory:
cd dev-to-clone/frontend
- Install dependencies:
or
npm install
yarn install
- Start the development server:
or
npm run dev
yarn dev
- Open your browser and go to
http://localhost:3000
to see the application in action.
To build the frontend for production, run:
npm run build
or
yarn build
The production-ready files will be in the .next
directory.
-
Navigate to the backend directory:
cd dev-to-clone/backend
-
Install dependencies:
npm install
-
Set up the environment variables:
- Copy the
.env.example
file to.env
:cp .env.example .env
- Update the
.env
file with your database credentials, OAuth configurations, and other settings.
- Copy the
-
Initialize the database:
npm run migrate
-
Run the tests:
npm run test
-
Start the development server:
npm run start
-
The backend server will run on
http://localhost:4000
by default.
To run the full application:
- Start the backend server following the instructions above.
- Start the frontend server following the instructions above.
- Ensure the frontend is configured to communicate with the backend API (update the API base URL in the frontend
.env
or configuration file if necessary). - Postman testing in Dev-to Clone
- Docker
- Vercel CLI (optional for local deployments)
- Build Docker images for the frontend and backend:
docker build -t frontend ./frontend docker build -t backend ./backend
- Push the Docker images to your container registry (e.g., Docker Hub or a private registry).
- Configure Vercel to pull and deploy the Docker images.
- CI/CD pipelines are set up using GitHub Actions. Every push to the main branch triggers automated tests and deploys the latest version to Vercel.
For more details on setting up the CI/CD workflow, check the .github/workflows
directory in the repository.
/dev-to-clone
|-- frontend/ # Frontend application (Next.js)
|-- backend/ # Backend application (TypeScript with OAuth and SQLite)
|-- Dockerfile/ # Store Dockerfiles for backend/frontend deployment
|-- .github/ # GitHub Actions CI/CD workflows
|-- README.md # Project documentation
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Make your changes and commit them:
git commit -m "Description of changes"
- Push your changes:
git push origin feature-name
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.