Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
npm-debug.log
build
.dockerignore
Dockerfile
docker-compose.yml
.git
.gitignore
README.md
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ yarn-debug.log*
yarn-error.log*

*.swp

.idea
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:18-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
libpixman-1-dev \
libcairo2-dev \
libpango1.0-dev \
libgif-dev \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy project files
COPY . .

# Expose port
EXPOSE 3000

# Start the application
CMD ["npm", "start"]
146 changes: 141 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,149 @@ Everything else are created from `create-react-app`, and they are irrelevant.
1. how to import MindAR as a npm package
2. how to create a React component for MindAR

# To run
# Prerequisites

- Node.js 18.x (LTS version)
- npm 6.x or later
- Docker and Docker Compose (for Docker setup)

## Installing Node.js 18

### macOS

1. Install nvm (Node Version Manager):
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
```

2. Install and use Node.js 18:
```bash
nvm install 18
nvm use 18
```

### Ubuntu/Debian

1. Install nvm:
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
```

2. Install and use Node.js 18:
```bash
nvm install 18
nvm use 18
```

### Switching Node.js Versions

If you need to switch between different Node.js versions:

1. List available versions:
```bash
nvm ls
```

2. Switch to a specific version:
```bash
nvm use <version>
```

3. Set default version:
```bash
nvm alias default 18
```

# Setup and Running

## Option 1: Using npm

### Installation

1. Install system dependencies:

For macOS:
```bash
brew install pkg-config pixman cairo pango giflib
```
> npm install
> npm run start

For Ubuntu/Debian:
```bash
sudo apt-get update
sudo apt-get install -y pkg-config libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev
```

2. Install project dependencies:
```bash
npm install
```

OR for HTTPS (so you can test on mobile devices connected in local network)
### Running the Application

For local development:
```bash
npm start
```
> npm run start-https

## Option 2: Using Docker

### Installation

1. Build and start the container:
```bash
docker-compose up --build
```

The Docker setup includes all necessary system dependencies:
- build-essential (for native module compilation)
- pkg-config
- libpixman-1-dev
- libcairo2-dev
- libpango1.0-dev
- libgif-dev

### Running the Application

The application will be available at:
- http://localhost:3000

# Troubleshooting

## Common Issues and Solutions

### 1. Canvas Installation Issues

If you encounter canvas installation errors, ensure you have the following system dependencies installed:

For macOS:
```bash
brew install pkg-config pixman cairo pango giflib
```

For Ubuntu/Debian:
```bash
sudo apt-get update
sudo apt-get install -y pkg-config libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev
```

### 2. Node.js Version Compatibility

If you experience compatibility issues:
- Use Node.js 18.x (LTS version)
- If using nvm, run:
```bash
nvm install 18
nvm use 18
```

# Development Notes

- The application uses Create React App for the development environment
- MindAR components are located in `src/mindar-viewer` and `src/mindar-three-viewer`
- For production builds, use `npm run build`
- For testing, use `npm test`

# License

This project is licensed under the MIT License - see the LICENSE file for details.
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:
app:
build: .
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
environment:
- NODE_ENV=development
- CHOKIDAR_USEPOLLING=true
command: npm start
Loading