Loading the Food Databases into Your OneRep Install
Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.
The datasource container starts empty: food search returns nothing until you import at least one catalog. Each catalog is independent and builds into its own database file, so you can import them in any order and the service serves whatever is present. Imports never interrupt the running service: each one builds a new file, verifies it, then swaps it in atomically.Run all commands from the selfhost/ directory unless otherwise noted.
USDA FoodData Central
wger Exercise Catalog
Open Food Facts
USDA FoodData Central contains generic whole foods with lab-measured nutrition data, all in the public domain. This is the catalog that makes a search for “chicken breast” return an actual ingredient rather than a supermarket SKU. Start here. It is the most useful single catalog for day-to-day logging.The download is approximately 3.1 GB and the import takes a few minutes.
1
Download the USDA dataset
From the selfhost/ directory, download and unzip the USDA CSV export:
docker compose exec datasource bun src/cli.ts import usda --csv-dir /tmp/usda/FoodData_Central_csv_2025-12-18
4
Clean up the temporary files
docker compose exec datasource rm -rf /tmp/usda
The wger catalog provides the exercise database used throughout the training features. Unlike the food catalogs, there is no file to download, because the importer fetches data directly from the wger API.
1
Run the import
From the selfhost/ directory:
docker compose exec datasource bun src/cli.ts import wger
There is no download step and no cleanup required. The import fetches the catalog over the network and builds the database file in place.
Open Food Facts contains packaged products and barcodes from around the world. This is the catalog that makes barcode scanning useful outside the US, and it includes product photos that USDA does not have.The full dump is large and the import is the most time-consuming of the three. Try a partial import first to confirm everything is working before committing to the full run.
The gzip file is read as a stream and never fully expanded on disk, so you only need space for the download itself rather than the ~50 GB it would unpack to. Products with no barcode, no name, or no nutrition data are dropped during import.
To see how many records are in each catalog currently serving requests:
docker compose exec datasource bun src/cli.ts stats
Rolling back an import
Each import keeps the previous database file so you can roll back if something goes wrong. To revert a catalog to its previous state:
# Roll back USDAdocker compose exec datasource bun src/cli.ts rollback usda# Roll back Open Food Factsdocker compose exec datasource bun src/cli.ts rollback off# Roll back wgerdocker compose exec datasource bun src/cli.ts rollback wger
The datasource README at apps/datasource/README.md documents how the catalogs are ranked, the de-duplication passes that run during import, and how search merges results across catalogs when more than one is loaded.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"OneRep","description":"Documentation for OneRep — training and nutrition in one log.","colors":{"primary":"#171a18","light":"#e8e6df","dark":"#171a18"},"logo":{"light":"https://mintcdn.com/onerep/Hrrr7qMnGhodBln_/logo/light.svg?fit=max\u0026auto=format\u0026n=Hrrr7qMnGhodBln_\u0026q=85\u0026s=8ccf15ffe3c028f2e5bbbf1c87313400","dark":"https://mintcdn.com/onerep/Hrrr7qMnGhodBln_/logo/dark.svg?fit=max\u0026auto=format\u0026n=Hrrr7qMnGhodBln_\u0026q=85\u0026s=0032744cb8f36fff09f04cc00b53ca8d","href":"https://onerep.life"},"favicon":"https://mintcdn.com/onerep/Hrrr7qMnGhodBln_/favicon.svg?fit=max\u0026auto=format\u0026n=Hrrr7qMnGhodBln_\u0026q=85\u0026s=54ce56943f96095a9962799d6cc10fc2","appearance":{"default":"system"},"navbar":{"links":[{"href":"https://app.onerep.life","label":"Open the app"},{"href":"mailto:hi@onerep.life","label":"Support"}],"primary":{"type":"github","href":"https://github.com/an2tha/onerep"}},"footer":{"links":[{"header":"Product","items":[{"label":"OneRep","href":"https://onerep.life"},{"label":"Open the app","href":"https://app.onerep.life"}]},{"header":"Docs","items":[{"label":"Quickstart","href":"/quickstart"},{"label":"API \u0026 MCP","href":"/api/overview"},{"label":"Self-hosting","href":"/selfhost/overview"}]},{"header":"Source","items":[{"label":"GitHub","href":"https://github.com/an2tha/onerep"}]}]},"fonts":{"heading":{"family":"Instrument Sans"},"body":{"family":"Instrument Sans"}},"contextual":{"options":["copy","view","chatgpt","claude","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"onerep","hasAudioNarration":false,"actualSubdomain":"onerep","customDomains":["docs.onerep.life"],"gitSource":{"type":"github","owner":"an2tha","repo":"onerep-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"issues":true,"edits":true,"thumbs":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ab50a2e3a6842c13ccf702a","clientVersion":"0.0.4227","searchFilterCounts":[{"language":"default","tag":"Guide","count":23},{"language":"default","tag":"Core Features","count":10},{"language":"default","tag":"API \u0026 MCP","count":8},{"language":"default","tag":"Self-Hosting","count":6},{"language":"default","tag":"Settings \u0026 Privacy","count":4},{"language":"default","tag":"Get Started","count":3},{"language":"default","tag":"MCP","count":3},{"language":"default","tag":"REST API","count":3},{"language":"default","tag":"Overview","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":true},"customCss":[]}
{"page":{"pagePath":"selfhost/food-database","slug":"/selfhost/food-database","pageMetadata":{"title":"Loading the Food Databases into Your OneRep Install","sidebarTitle":"Food Database","description":"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.","href":"/selfhost/food-database"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Step,Steps,Tab,Tabs,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The datasource container starts empty: food search returns nothing until you import at least one catalog. Each catalog is independent and builds into its own database file, so you can import them in any order and the service serves whatever is present. Imports never interrupt the running service: each one builds a new file, verifies it, then swaps it in atomically.`}),`\n`,_jsxs(_components.p,{children:[`Run all commands from the `,_jsx(_components.code,{children:`selfhost/`}),` directory unless otherwise noted.`]}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`USDA FoodData Central`,id:`usda-fooddata-central`,children:[_jsxs(_components.p,{children:[`USDA FoodData Central contains generic whole foods with lab-measured nutrition data, all in the public domain. This is the catalog that makes a search for “chicken breast” return an actual ingredient rather than a supermarket SKU. `,_jsx(_components.strong,{children:`Start here.`}),` It is the most useful single catalog for day-to-day logging.`]}),_jsx(_components.p,{children:`The download is approximately 3.1 GB and the import takes a few minutes.`}),_jsxs(Steps,{children:[_jsxs(Step,{title:`Download the USDA dataset`,children:[_jsxs(_components.p,{children:[`From the `,_jsx(_components.code,{children:`selfhost/`}),` directory, download and unzip the USDA CSV export:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -O`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://fdc.nal.usda.gov/fdc-datasets/FoodData_Central_csv_2025-12-18.zip`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`unzip`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -q`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` FoodData_Central_csv_2025-12-18.zip`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` usda`})]}),`\n`]})})})]}),_jsx(Step,{title:`Copy the files into the container`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` usda`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource:/tmp/usda`})]}),`\n`]})})})}),_jsx(Step,{title:`Run the import`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` usda`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --csv-dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /tmp/usda/FoodData_Central_csv_2025-12-18`})]}),`\n`]})})})}),_jsx(Step,{title:`Clean up the temporary files`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rm`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -rf`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /tmp/usda`})]}),`\n`]})})})})]})]}),_jsxs(Tab,{title:`wger Exercise Catalog`,id:`wger-exercise-catalog`,children:[_jsx(_components.p,{children:`The wger catalog provides the exercise database used throughout the training features. Unlike the food catalogs, there is no file to download, because the importer fetches data directly from the wger API.`}),_jsx(Steps,{children:_jsxs(Step,{title:`Run the import`,children:[_jsxs(_components.p,{children:[`From the `,_jsx(_components.code,{children:`selfhost/`}),` directory:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` wger`})]}),`\n`]})})}),_jsx(_components.p,{children:`There is no download step and no cleanup required. The import fetches the catalog over the network and builds the database file in place.`})]})})]}),_jsxs(Tab,{title:`Open Food Facts`,id:`open-food-facts`,children:[_jsx(_components.p,{children:`Open Food Facts contains packaged products and barcodes from around the world. This is the catalog that makes barcode scanning useful outside the US, and it includes product photos that USDA does not have.`}),_jsx(_components.p,{children:`The full dump is large and the import is the most time-consuming of the three. Try a partial import first to confirm everything is working before committing to the full run.`}),_jsx(Note,{children:_jsx(_components.p,{children:`The gzip file is read as a stream and never fully expanded on disk, so you only need space for the download itself rather than the ~50 GB it would unpack to. Products with no barcode, no name, or no nutrition data are dropped during import.`})}),_jsxs(Steps,{children:[_jsxs(Step,{title:`Download the Open Food Facts dump`,children:[_jsxs(_components.p,{children:[`From the `,_jsx(_components.code,{children:`selfhost/`}),` directory:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -O`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://static.openfoodfacts.org/data/openfoodfacts-products.jsonl.gz`})]}),`\n`]})})})]}),_jsx(Step,{title:`Copy the file into the container`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` openfoodfacts-products.jsonl.gz`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource:/tmp/off.jsonl.gz`})]}),`\n`]})})})}),_jsxs(Step,{title:`Run a partial import to verify (recommended first)`,children:[_jsx(_components.p,{children:`A limit of 50,000 products takes minutes rather than hours and is enough to confirm barcode scanning and search are working:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` off`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --file`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /tmp/off.jsonl.gz`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --limit`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50000`})]}),`\n`]})})})]}),_jsxs(Step,{title:`Run the full import when ready`,children:[_jsx(_components.p,{children:`Once you are satisfied, re-run without the limit to import the entire catalog:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` import`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` off`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --file`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /tmp/off.jsonl.gz`})]}),`\n`]})})})]}),_jsx(Step,{title:`Clean up the temporary file`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rm`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /tmp/off.jsonl.gz`})]}),`\n`]})})})})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`checking-import-stats`,children:`Checking import stats`}),`\n`,_jsx(_components.p,{children:`To see how many records are in each catalog currently serving requests:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` stats`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`rolling-back-an-import`,children:`Rolling back an import`}),`\n`,_jsx(_components.p,{children:`Each import keeps the previous database file so you can roll back if something goes wrong. To revert a catalog to its previous state:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Roll back USDA`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rollback`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` usda`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Roll back Open Food Facts`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rollback`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` off`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Roll back wger`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` compose`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` datasource`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` bun`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` src/cli.ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rollback`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` wger`})]}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`The datasource README at `,_jsx(_components.code,{children:`apps/datasource/README.md`}),` documents how the catalogs are ranked, the de-duplication passes that run during import, and how search merges results across catalogs when more than one is loaded.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Loading the Food Databases into Your OneRep Install","sidebarTitle":"Food Database","description":"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.","href":"/selfhost/food-database"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Checking import stats","slug":"checking-import-stats","depth":2,"children":[]},{"title":"Rolling back an import","slug":"rolling-back-an-import","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"onerep","siteName":"OneRep","title":"Loading the Food Databases into Your OneRep Install - OneRep","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-20T01:11:44.521Z","originalFileLocation":"selfhost/food-database.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.\">\u003cmeta data-mint-head name=\"application-name\" content=\"OneRep\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Loading the Food Databases into Your OneRep Install - OneRep\">\u003cmeta data-mint-head property=\"og:description\" content=\"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"OneRep\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.onerep.life/selfhost/food-database\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://onerep.mintlify.site/_mintlify/api/og/v2?division=Self-Hosting\u0026amp;title=Loading+the+Food+Databases+into+Your+OneRep+Install\u0026amp;description=Import+USDA+FoodData+Central%2C+Open+Food+Facts%2C+and+the+wger+exercise+catalog.+Each+is+independent%2C+so+you+can+import+one%2C+two%2C+or+all+three.\u0026amp;theme=33b1c19a2e869b56e7e1b3b6\u0026amp;signature=5217f6c214b8d741edfe6f747c3854a2b4a7204865c3123b299190e54095b9c1\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Loading the Food Databases into Your OneRep Install - OneRep\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://onerep.mintlify.site/_mintlify/api/og/v2?division=Self-Hosting\u0026amp;title=Loading+the+Food+Databases+into+Your+OneRep+Install\u0026amp;description=Import+USDA+FoodData+Central%2C+Open+Food+Facts%2C+and+the+wger+exercise+catalog.+Each+is+independent%2C+so+you+can+import+one%2C+two%2C+or+all+three.\u0026amp;theme=33b1c19a2e869b56e7e1b3b6\u0026amp;signature=5217f6c214b8d741edfe6f747c3854a2b4a7204865c3123b299190e54095b9c1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/onerep/NFLOqOVE9x2PwVRc/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"OneRep\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#171a18\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.onerep.life/selfhost/food-database\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/selfhost/food-database.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.onerep.life/#organization\",\"name\":\"OneRep\",\"url\":\"https://docs.onerep.life\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/onerep/Hrrr7qMnGhodBln_/logo/light.svg?fit=max\u0026auto=format\u0026n=Hrrr7qMnGhodBln_\u0026q=85\u0026s=8ccf15ffe3c028f2e5bbbf1c87313400\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.onerep.life#website\",\"name\":\"OneRep\",\"url\":\"https://docs.onerep.life\",\"publisher\":{\"@id\":\"https://docs.onerep.life/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.onerep.life/selfhost/food-database#webpage\",\"url\":\"https://docs.onerep.life/selfhost/food-database\",\"name\":\"Loading the Food Databases into Your OneRep Install\",\"description\":\"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.\",\"dateModified\":\"2026-08-20T01:11:44.521Z\",\"isPartOf\":{\"@id\":\"https://docs.onerep.life#website\"},\"breadcrumb\":{\"@id\":\"https://docs.onerep.life/selfhost/food-database#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.onerep.life/selfhost/food-database#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Self-Hosting\",\"item\":\"https://docs.onerep.life/selfhost/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Loading the Food Databases into Your OneRep Install\",\"item\":\"https://docs.onerep.life/selfhost/food-database\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.onerep.life/selfhost/food-database#article\",\"headline\":\"Loading the Food Databases into Your OneRep Install\",\"name\":\"Loading the Food Databases into Your OneRep Install\",\"description\":\"Import USDA FoodData Central, Open Food Facts, and the wger exercise catalog. Each is independent, so you can import one, two, or all three.\",\"url\":\"https://docs.onerep.life/selfhost/food-database\",\"mainEntityOfPage\":{\"@id\":\"https://docs.onerep.life/selfhost/food-database#webpage\"},\"dateModified\":\"2026-08-20T01:11:44.521Z\",\"publisher\":{\"@id\":\"https://docs.onerep.life/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.onerep.life#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"OneRep\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"OneRep\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/selfhost/food-database.md","siteName":"OneRep","nav":{"global":null,"tabs":[{"tab":"Guide","groups":[{"group":"Get Started","pages":[{"title":"What Is OneRep? Features, Platforms, and the AI Coach","sidebarTitle":"Introduction","href":"/introduction"},{"title":"Get Started with OneRep: Log Your First Day in Minutes","sidebarTitle":"Quickstart","href":"/quickstart"},{"title":"Set Up Your OneRep Account, Profile, and Privacy Settings","sidebarTitle":"Account Setup","href":"/account-setup"}]},{"group":"Core Features","pages":[{"title":"Daily Dashboard: Calories, Macros, Water, and Training in One View","sidebarTitle":"Dashboard","href":"/features/dashboard"},{"title":"Journal: Daily Reflections and Personal Trackers","sidebarTitle":"Journal","href":"/features/journal"},{"title":"Nutrition Tracking: Log Food, Macros, and Daily Habits","sidebarTitle":"Nutrition","href":"/features/nutrition"},{"title":"Training and Workouts: Build, Schedule, and Log Sessions","sidebarTitle":"Training","href":"/features/training"},{"title":"Endurance: Walks, Runs, Rides, and Hikes","sidebarTitle":"Endurance","href":"/features/endurance"},{"title":"Progress Tracking: Body Check-ins, Measurements, and Charts","sidebarTitle":"Progress","href":"/features/progress"},{"title":"Health: Recovery Score, Dials, and Apple Health / Health Connect Sync","sidebarTitle":"Health","href":"/features/health"},{"title":"Health Metrics by Platform: Apple Health and Health Connect Mapping","sidebarTitle":"Health Metrics","href":"/features/health-metrics"},{"title":"Recovery Mode When You Are Unwell","sidebarTitle":"Recovery mode","href":"/features/recovery-mode"},{"title":"AI Coach: Briefings, Meal Logging, and Workout Planning","sidebarTitle":"Coach","href":"/features/coach"}]},{"group":"Self-Hosting","pages":[{"title":"Self-Hosting OneRep: What You Get and What You Need","sidebarTitle":"Overview","href":"/selfhost/overview"},{"title":"Install OneRep on Your Own Server or Local Machine","sidebarTitle":"Install","href":"/selfhost/install"},{"title":"Run OneRep Behind a Reverse Proxy with TLS","sidebarTitle":"Reverse proxy","description":"OneRep is three origins, not one, and one of them is a WebSocket. Give each a hostname, forward the upgrade headers, then re-run the installer so the app is rebuilt against the new URLs.","href":"/selfhost/reverse-proxy"},{"title":"Loading the Food Databases into Your OneRep Install","sidebarTitle":"Food Database","href":"/selfhost/food-database"},{"title":"Building Mobile Apps Pointed at Your OneRep Install","sidebarTitle":"Mobile Apps","description":"Install OneRep as a PWA with no toolchain, or build native iOS and Android apps with Capacitor and point them at your own backend.","href":"/selfhost/mobile-apps"},{"title":"Optional Integrations for Your OneRep Self-Hosted App","sidebarTitle":"Integrations","href":"/selfhost/integrations"}]},{"group":"Settings \u0026 Privacy","pages":[{"title":"Account Settings: Email, Password, and Sign-In Methods","sidebarTitle":"Account","href":"/settings/account"},{"title":"Daily Calorie Targets, Macros, and Nutrition Strategy","sidebarTitle":"Targets","href":"/settings/targets"},{"title":"Export Your OneRep Data, API Access, and Diary Sharing","sidebarTitle":"Data Export","href":"/settings/data-export"},{"title":"Privacy Controls, Analytics, and Data Choices in OneRep","sidebarTitle":"Privacy","href":"/settings/privacy"}]}]},{"tab":"API \u0026 MCP","pages":[{"title":"API \u0026 MCP","href":"/api/overview"}]}]},"basePath":"","title":"Loading the Food Databases into Your OneRep Install - OneRep","deploymentId":"dpl_vSEmv961Ncyvz1psVwgUnTXQMSYk","buildId":"dpl_vSEmv961Ncyvz1psVwgUnTXQMSYk","dynamics":[],"chunks":[]}