Devvit CLI
The Devvit CLI enables you to create, upload, and manage your apps. It's the bridge between your codebase and Reddit.
We collect usage metrics when you use the Devvit CLI. For more information, see Reddit’s Developer Terms and the Reddit Privacy Policy. You can opt out at any time by using the devvit metrics off command.
devvit create icons
Bundles all SVG files in the /assets folder into a new file (src/icons.ts by default). Enabling you to import local SVG assets in your app code.
Usage
devvit create icons [output-file]
Optional argument
-
output-filePath to the output file. Defaults to
src/icons.ts.
Generating the SVG bundle file
devvit create icons
$ devvit create icons "src/my-icons.ts"
Using the SVG files in app code
import { Devvit } from "@devvit/public-api";
import Icons from "./my-icons.ts";
Devvit.addCustomPostType({
name: "my-custom-post",
render: (_context) => {
return (
<blocks>
<image
url={Icons["my-image.svg"]}
imageHeight="32px"
imageWidth="32px"
/>
</blocks>
);
},
});
export default Devvit;
devvit help
Display help for devvit
Usage
devvit help
devvit install
Install an app from the Apps directory to a subreddit that you moderate. You can specify a version to install or default to @latest (the latest version).
Usage
devvit install <subreddit> [app-name]@[version]
Required arguments
-
subredditName of the installation subreddit. The "r/" prefix is optional.
Optional arguments
-
app-nameName of the app to install (defaults to current project).
-
versionSpecify the desired version (defaults to latest).
Examples
devvit install r/mySubreddit
$ devvit install mySubreddit my-app
$ devvit install r/mySubreddit my-app@1.2.3
$ devvit install r/mySubreddit @1.2.3
devvit list apps
To see a list of apps you've published
Usage
devvit list apps
devvit list installs
To see a list of all apps currently installed on a specified subreddit.
If no subreddit is specified, you'll get a list of all apps installed by you.
Usage
devvit list installs [subreddit]
Optional argument
-
subredditName of the subreddit to look up installations for. The "r/" prefix is optional.
Examples
devvit list installs
$ devvit list installs mySubreddit
$ devvit list installs r/mySubreddit
devvit login
Login to Devvit with your Reddit account in the browser.
Usage
devvit login [--copy-paste]
Optional argument
-
--copy-pasteIf present, user will copy-paste code from the browser instead of the localhost.
devvit logout
Logs the current user out of Devvit.
Usage
devvit logout
devvit logs
Stream logs for an installation within a specified subreddit. You can see 5,000 logs or up to 7 days of log events.
Usage
devvit logs <subreddit> [app-name] [-d <value>] [-j] [-s <value>] [--verbose]
Required arguments
-
subredditThe subreddit name. The "r/" prefix is optional.
-
app-nameThe app name (defaults to working directory app).
Optional arguments
-
-d <value>, --dateformat <value>Specify the format for rendering dates. Defaults to
MMM d HH:mm:ss(Jan 15 18:30:03). See more about format options here. -
-j, --jsonOutput JSON for each log line
-
-s <value>, --since <value>Specify how far back you want the log streaming to start. Defaults to a
0m(now) if omitted.Supported format:
ssecondsmminuteshhoursddayswweeks
For example
15s,2w1d, or30m. -
--verboseDisplays the log levels and timestamps when the logs were created.
Examples
devvit logs r/mySubreddit
$ devvit logs mySubreddit my-app
$ devvit logs mySubreddit my-app --since 15s
$ devvit logs mySubreddit my-app --verbose
devvit new
Create a new app.
Usage
devvit new [directory-name] [--here]
Optional arguments
-
directory-nameDirectory name for your new app project. This creates a new directory for your app code. If no name is entered, you will be prompted to choose one.
-
--hereGenerate the project here and not in a subdirectory.
Examples
devvit new
$ devvit new tic-tac-toe
$ devvit new --here
devvit playtest
Installs your app to your test subreddit and starts a playtest session. A new version of your app is installed whenever you save changes to your app code, and logs are continuously streamed. Press ctrl+c to end the playtest session. Once ended, the latest installed version will remain unless you revert to a previous version using devvit install. For more information, see the playtest page.
Usage
devvit playtest
Optional argument
- subreddit Name of a test subreddit with less than 200 subscribers that you moderate. The "r/" prefix is optional.
If no subreddit is specified, the command will use the first available option from:
- DEVVIT_SUBREDDIT environment variable
- dev.subreddit field in devvit.json
- The playtest subreddit stored for your app
If none exist, a new playtest subreddit will be automatically created.
devvit settings list
List settings for your app. These settings exist at the global app-scope and are available to all instances of your app.
Usage
devvit settings list
devvit settings set
Create and update settings for your app. These settings will be added at the global app-scope.
Usage
devvit settings set <my-setting>
Example
devvit settings set my-feature-flag
devvit uninstall
Uninstall an app from a specified subreddit.
Usage
devvit uninstall <subreddit> [app-name]
Required argument
-
subredditName of the subreddit. The "r/" prefix is optional. Requires moderator permissions in the subreddit.
-
app-nameName of the app (defaults to the working directory app).
Examples
devvit uninstall r/mySubreddit
$ devvit uninstall mySubreddit
$ devvit uninstall mySubreddit my-app
devvit update app
Update @devvit project dependencies to the currently installed CLI's version
Usage
devvit update app
devvit upload
Upload an app to the App directory. By default the app is private and visible only to you.
Usage
devvit upload [--bump major|minor|patch|prerelease] [--copyPaste]
Optional arguments
-
--bump <option>Type of version bump (major|minor|patch|prerelease)
-
--copyPasteCopy-paste the auth code instead of opening a browser
devvit version
Get the version of the locally installed Devvit CLI.
Usage
devvit version
devvit view
Shows you the latest version of your app and some data about uploads. Includes an optional --json flag to get information in JSON format.
Usage
devvit view [APPSLUG[@VERSION]] [--json] [version]
devvit whoami
Display the currently logged in Reddit user.
Usage
devvit whoami