Development Guide
This guide covers the development workflow, coding standards, and best practices for The Lab Notebook project.
Development Workflow
Setting Up Your Environment
- Fork and clone the repository
- Install dependencies:
npm install
- Start development server:
npm run dev
- Open browser: http://localhost:3000
Branch Strategy
main
- Main branch for productiondev
- Development branch for ongoing work- Feature branches:
feature/your-feature-name
Making Changes
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following coding standards
-
Run quality checks:
npm run check # Runs lint + verify-links
-
Commit your changes:
git add . git commit -m "feat: describe your changes"
-
Push and create a pull request
Coding Standards
JavaScript/JSX
- Use ES6+ features and modern JavaScript
- Follow ESLint configuration (see
.eslintrc.js
) - Use Prettier for consistent formatting
- Prefer functional components and hooks
MDX Content
- Use semantic Markdown structure (proper heading hierarchy)
- Embed React components when interactive elements are needed
- Include alt text for all images
- Use relative paths for internal links
File Organization
content/
├── index.mdx # Homepage
├── projects.mdx # Projects listing
└── project/
├── project-name/
│ ├── _meta.js # Navigation metadata
│ ├── index.mdx # Project overview
│ └── additional-pages.mdx
└── the-lab-notebook/
└── docs/ # Project documentation
Component Development
Components should be:
- Reusable and well-documented
- Accessible (proper ARIA labels, keyboard navigation)
- Responsive (mobile-first design)
- Typed with PropTypes or TypeScript interfaces
Example component structure:
import React from 'react'
const MyComponent = ({ title, children, className = '' }) => {
return (
<div className={`base-styles ${className}`}>
<h2>{title}</h2>
{children}
</div>
)
}
export default MyComponent
Key Files and Directories
Configuration Files
next.config.mjs
- Next.js configurationtheme.config.jsx
- Nextra theme configurationtailwind.config.js
- Tailwind CSS settingseslint.config.js
- Linting rulestsconfig.json
- TypeScript configuration and path aliaseslayout.jsx
– Root layout for Next.js App Routerglobal.css
– Global styles for the applicationpackage.json
- Dependencies and scripts
Core Directories
app/
- Next.js App Router pagescomponents/
- Reusable React componentscontent/
- MDX content fileslib/
- Utility functions and helperspublic/
- Static assetsscripts/
- Build and maintenance scripts
Development Scripts
# Development
npm run dev # Start dev server with Turbopack
npm run build # Build for production
npm run start # Start production server
# Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint errors automatically
npm run verify-links # Check internal links
npm run check # Run lint + verify-links
# Maintenance
node scripts/create-placeholders.js # Generate placeholder images
Content Creation Guidelines
Adding New Projects
-
Create project directory:
mkdir content/project/your-project-name
-
Add metadata file:
// content/project/your-project-name/_meta.js const meta = { index: 'Project Overview', 'section-1': 'First Section', 'section-2': 'Second Section', } export default meta
-
Create content files:
# Your Project Name Project description and content here. <FeatureCard title='Key Feature' summary='Description of the feature' tags={['tag1', 'tag2']} href='/link-to-more-info' />
Working with Images
- Place images in
public/images/
- Use descriptive filenames
- Optimize images (use
Sharp
for processing) - Include alt text for accessibility
Example:
export const IMAGE_DIR = '/images/placeholders'
<LightboxImage
src={`${IMAGE_DIR}/widescreen-placeholder_4x3.webp`}
largeSrc={`${IMAGE_DIR}/widescreen-placeholder_full_4x3.jpg`}
alt='4:3 Widescreen placeholder'
aspectRatio='4/3'
/>
Using Components
Import and use project components:
import FeatureCard from '@/components/FeatureCard'
export const IMAGE_DIR = '/images/placeholders'
<FeatureCard
title='Component Feature'
summary='Brief description'
tags={['react', 'component']}
href='/docs/components'
image={`${IMAGE_DIR}/component-preview_16x9.webp`}
/>
Testing and Quality Assurance
Before Committing
Always run these checks:
npm run check # Linting and link verification
Link Verification
The project includes automated link checking:
- Internal links are verified against existing content
- Asset links are checked for file existence
- Broken links are reported with file locations
Pre-commit Hooks
The project uses Husky for pre-commit hooks that:
- Format code with Prettier
- Fix ESLint errors
- Verify links in MDX files
Troubleshooting
Common Issues
- Build errors - Check console for specific error messages
- Link verification failures - Ensure all referenced files exist
- Component not found - Check import paths and exports
- Styling issues - Verify Tailwind classes and responsive design
Getting Help
- Check existing documentation in
/docs
- Look at similar implementations in the codebase
- Run
npm run check
to identify issues - Check the browser console for runtime errors
Performance Considerations
- Use Next.js Image component for optimized images
- Implement lazy loading for heavy components
- Minimize bundle size by avoiding unnecessary dependencies
- Use static generation where possible
Deployment
The project is configured for:
- Automatic builds on push to main branch
- Static site generation for optimal performance
- CDN deployment for global distribution
Before deploying:
- Run
npm run build
locally to test - Verify all links work in production build
- Test responsive design on multiple devices
Last updated on