A comprehensive guide for setting up LemoBook locally and deploying it to Vercel, suitable for beginners.
Installing and Deploying LemoBook: A Step-by-Step Guide
This guide will walk you through the process of setting up LemoBook on your local machine and deploying it to Vercel. Even if you're new to web development, you should be able to follow these steps to get your LemoBook instance up and running.
Prerequisites
- Node.js (version 14 or later)
- npm (usually comes with Node.js)
- Git
- A GitHub account
- A Vercel account
Step 1: Clone the Repository
- Open your terminal or command prompt.
- Navigate to the directory where you want to store your project.
- Run the following command:
git clone https://github.com/lemoabc/gitbase.git
cd gitbase
Step 2: Install Dependencies
In the project directory, run:
npm install
This will install all necessary dependencies for the project.
Step 3: Set Up Environment Variables
- In the root of your project, create a file named
.env.local
. - Open this file and add the following lines:
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_OWNER=your_github_username
GITHUB_REPO=your_repo_name
ACCESS_PASSWORD=your_secure_access_password
Replace the placeholders with your actual GitHub information and desired access password.
Step 4: Configure GitHub Repository
- Create a new repository on GitHub if you haven't already.
- In your GitHub repository, create two folders:
data/json
anddata/md
. - In the
data/json
folder, create a file namedresources.json
with an empty array:[]
.
Step 5: Run the Development Server
To start the development server, run:
npm run dev
Open http://localhost:3000
in your browser. You should see the LemoBook homepage.
Step 6: Build the Project
If the development server runs without errors, try building the project:
npm run build
If this completes successfully, your project is ready for deployment.
Step 7: Deploy to Vercel
- Log in to your Vercel account.
- Click "New Project".
- Import your LemoBook repository from GitHub.
- In the "Configure Project" step, add the following environment variables:
GITHUB_TOKEN
GITHUB_OWNER
GITHUB_REPO
ACCESS_PASSWORD
Use the same values as in your.env.local
file.
- Click "Deploy".
Step 8: Test Your Deployment
Once the deployment is complete, Vercel will provide you with a URL. Open this URL in your browser to verify that your LemoBook instance is working correctly.
Step 9: Configure Custom Domain (Optional)
If you want to use your own domain:
- In your Vercel project dashboard, go to "Settings" > "Domains".
- Add your custom domain and follow Vercel's instructions for DNS configuration.
Using LemoBook
- To access the admin panel, go to
/admin
and use theACCESS_PASSWORD
you set. - You can now create, edit, and manage articles and resources through the admin interface.
- All changes will be automatically synced with your GitHub repository.
Troubleshooting
If you encounter any issues:
- Make sure all environment variables are correctly set both locally and on Vercel.
- Check the console in your browser and the Vercel deployment logs for any error messages.
- Ensure your GitHub token has the necessary permissions (repo scope).
Congratulations! You've successfully set up and deployed your own LemoBook instance. Enjoy your new database-free, GitHub-powered website!
For more help, refer to the LemoBook documentation or open an issue on the GitHub repository.