← Back to loverajoel/jstips

How to Deploy & Use loverajoel/jstips

JS Tips Deployment and Usage Guide

1. Prerequisites

  • Node.js (version 12 or higher) - Required for running the development server and build tools
  • npm or yarn - Package manager for installing dependencies
  • Git - For cloning the repository

2. Installation

Clone the Repository

git clone https://github.com/loverajoel/jstips.git
cd jstips

Install Dependencies

npm install
# or
yarn install

3. Configuration

This project does not require any specific configuration files or environment variables. The tips are stored as markdown files in the repository.

4. Build & Run

Development Server

npm run dev
# or
yarn dev

This starts a local development server at http://localhost:3000 (or similar) for previewing the tips.

Build for Production

npm run build
# or
yarn build

This generates a static build in the dist folder that can be deployed to any static hosting service.

Preview Production Build

npm run preview
# or
yarn preview

This starts a local server to preview the production build.

5. Deployment

Since this is a static site generated from markdown files, you can deploy it to any static hosting service:

GitHub Pages

  1. Ensure your repository has GitHub Pages enabled
  2. Run npm run build
  3. Commit the dist folder to your repository
  4. Configure GitHub Pages to serve from the dist folder

Netlify

  1. Connect your repository to Netlify
  2. Set the build command to npm run build
  3. Set the publish directory to dist

Vercel

  1. Import your repository to Vercel
  2. Use default settings (build command: npm run build, output directory: dist)

Other Options

  • Surge.sh: npm install -g surge && surge dist
  • Render: Static site hosting with automatic deployments
  • AWS S3: Host the static files in an S3 bucket

6. Troubleshooting

Common Issues and Solutions

Issue: Build fails with dependency errors

  • Solution: Try clearing the npm cache with npm cache clean --force and reinstall dependencies

Issue: Development server won't start

  • Solution: Check that port 3000 is not being used by another process
  • Solution: Ensure all dependencies are properly installed

Issue: Tips not displaying correctly

  • Solution: Verify that markdown files are properly formatted in the src/tips directory
  • Solution: Check the console for any JavaScript errors

Issue: Images not loading

  • Solution: Ensure all image paths are correct and assets are included in the build

Issue: Contributing a new tip

  • Solution: Follow the CONTRIBUTING.md guidelines
  • Solution: Ensure your tip follows the format of existing tips (short, useful, under 2 minutes to read)

Issue: Want to stay updated with new tips

Additional Notes

  • This project is community-driven, so contributions are welcome
  • Tips are written in markdown format and can be easily added by following the existing structure
  • The project uses a static site generator to convert markdown tips into a browsable website
  • No database or backend services are required - everything is file-based