The Nuxt3 version of Sakepedia, an open data project for Japanese sake created by everyone.
- Docker
- Nuxt3.11.1
- yarn
Please follow steps below one by one
git clone [email protected]:Code-for-SAKE/Sakepedia-Nuxt3.git
Go to Firebase website, create new project (It's free.) Currently, the url is https://console.firebase.google.com/
- new Project
- Project Name: as you like e.g. sakepedia-nuxt3
- Spark
- Firestore Database
- default
- Authentication
- Google enabled
- Add a web app to your project
After project created, get firebase setup info here:
- Project overview -> press
</>
website icon - Fill the project name, could be the same as
sakepedia-nuxt3
, register - Get info under const (do not leak these info)
const firebaseConfig = {
apiKey: "XXXXXXXXXXXX",
authDomain: "XXXX",
projectId: "XXXX",
storageBucket: "XXXXX",
messagingSenderId: "XXXX",
appId: "XXXX"
};
Create file under this project Sakepedia-Nuxt3/app/.env
, fill info got from above:
NUXT_PUBLIC_FIREBASE_API_KEY=
NUXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NUXT_PUBLIC_FIREBASE_PROJECT_ID=
NUXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NUXT_PUBLIC_FIREBASE_MESSAGEING_SENDER_ID=
NUXT_PUBLIC_FIREBASE_APP_ID=
NUXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
The project should already contain this file:
.firebaserc
{
"projects": {
"default": "sakepedia-nuxt3"
}
}
It may take an hour, depends on your networking speed.
- nuxt
- Use Nuxt3 base container
- firebase
- Use firebase emulator base container
cd Sakepedia-Nuxt3
docker-compose up -d
docker-compose run --rm firebase firebase login --no-localhost
- Collecting an error report is optional
- Access the URL that appears
- Check the session ID
- Paste the code that appears into the CLI
- If
Success! Logged in as xxxx
appears, you're logged in
docker-compose exec nuxt bash
yarn install
docker-compose exec nuxt bash
after enter container, run yarn
yarn dev
After yarn done, you can see the terminal have line like this
[11:23:47 AM] Nuxt 3.12.2 with Nitro 2.9.6
➜ Local: http://0.0.0.0:3000/
...
...
etc.
...
[nitro 11:24:01 AM] ✔ Nuxt Nitro server built in 1630 ms
Website: http://localhost:3000/
Firebase Emulator: http://localhost:4000/
yarn install
yarn dev
yarn build --preset=firebase
npx firebase-tools deploy --project sakepedia-nuxt3
ESLint is used
- Add extension for ESLint
- Add the following items to
.vscode/settings.json
"eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [
"./app"
]
Prettier is used
- Add Prettier extension into your VSCode
rm -rf /opt/data/bkp
firebase emulators:export /opt/data/bkp
rm -rf /opt/data/bkp
gcloud storage cp -r "gs://sakepedia-data/2024-06-12T10:56:22_57740" /opt/data
mv /opt/data/2024-06-12T10:56:22_57740 /opt/data/bkp
During the installation yarn install
step inside the container, the installation fails with an error message mentioning gyp
.
In order to fix it, we need to remove the firebase-admin
dependency using yarn remove firebase-admin
before creating the container.
(Note: You might want to use the dockerfile called "Dockerfile.m5" as it uses an arm64 image to run the project).