diff --git a/src-tauri/src/clash.rs b/src-tauri/src/clash.rs
index ef25ff136cec1d039f7913836a4dc20b1bc8062d..c727ffde4e0da287c9a2c77329450376b03f6fd5 100644
--- a/src-tauri/src/clash.rs
+++ b/src-tauri/src/clash.rs
@@ -1,6 +1,4 @@
 extern crate log;
-extern crate reqwest;
-extern crate serde_yaml;
 
 use crate::init::app_home_dir;
 use tauri::api::process::{Command, CommandEvent};
@@ -29,15 +27,3 @@ pub fn run_clash_bin() {
     }
   });
 }
-
-pub async fn fetch_url(profile_url: &str) -> Result<(), reqwest::Error> {
-  let resp = reqwest::get(profile_url).await?;
-  println!("{:#?}", resp);
-
-  let header = resp.headers().clone();
-  println!("{:?}", header);
-
-  let data = resp.text_with_charset("utf-8").await?;
-  println!("{:#?}", data);
-  Ok(())
-}
diff --git a/src-tauri/src/cmd.rs b/src-tauri/src/cmd.rs
index 9b02ca113f45219dfd7b6763a3387c1294b884e9..7629a44225e9292115b95271396e1bb80f46ebf9 100644
--- a/src-tauri/src/cmd.rs
+++ b/src-tauri/src/cmd.rs
@@ -1,15 +1,16 @@
 use crate::clash;
+use crate::profiles;
 use tauri::api::process::kill_children;
 
 #[tauri::command]
-pub fn restart_sidebar() {
+pub fn cmd_restart_sidebar() {
   kill_children();
   clash::run_clash_bin();
 }
 
 #[tauri::command]
-pub async fn get_config_data(url: String) -> Result<String, String> {
-  match clash::fetch_url(&url).await {
+pub async fn cmd_import_profile(url: String) -> Result<String, String> {
+  match profiles::import_profile(&url).await {
     Ok(_) => Ok(String::from("success")),
     Err(_) => Err(String::from("error")),
   }
diff --git a/src-tauri/src/init.rs b/src-tauri/src/init.rs
index 7e77c084dc91e3c60f43ec94c1a513e3310eb0fa..374a170ac4b843736ccdb3ffe56a850901ac95cd 100644
--- a/src-tauri/src/init.rs
+++ b/src-tauri/src/init.rs
@@ -13,6 +13,8 @@ use std::time::{SystemTime, UNIX_EPOCH};
 use tauri::api::path::{home_dir, resource_dir};
 use tauri::PackageInfo;
 
+use crate::config::verge::VergeConfig;
+
 /// get the verge app home dir
 pub fn app_home_dir() -> PathBuf {
   home_dir()
@@ -120,8 +122,16 @@ pub fn read_clash_config() -> Mapping {
 }
 
 /// Get the user config of verge
-pub fn read_verge_config() -> Mapping {
+pub fn read_verge_config() -> VergeConfig {
   let yaml_path = app_home_dir().join("verge.yaml");
   let yaml_str = fs::read_to_string(yaml_path).unwrap();
-  serde_yaml::from_str::<Mapping>(&yaml_str).unwrap()
+  serde_yaml::from_str::<VergeConfig>(&yaml_str).unwrap()
+}
+
+/// Save the user config of verge
+pub fn save_verge_config(verge_config: &VergeConfig) {
+  let yaml_path = app_home_dir().join("verge.yaml");
+  let yaml_str = serde_yaml::to_string(&verge_config).unwrap();
+  let yaml_str = String::from("# Config File for Clash Verge\n\n") + &yaml_str;
+  fs::write(yaml_path, yaml_str.as_bytes()).unwrap();
 }
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 97da2abde2e4acbcb575bcccd8ae2cfd1f70fb1c..6cb2839d5398a5d514585a73baed7ccdf7c13987 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -7,7 +7,9 @@ extern crate tauri;
 
 mod clash;
 mod cmd;
+mod config;
 mod init;
+mod profiles;
 mod sysopt;
 
 use tauri::{
@@ -54,8 +56,8 @@ fn main() -> std::io::Result<()> {
       _ => {}
     })
     .invoke_handler(tauri::generate_handler![
-      cmd::get_config_data,
-      cmd::restart_sidebar,
+      cmd::cmd_import_profile,
+      cmd::cmd_restart_sidebar,
     ])
     .build(tauri::generate_context!())
     .expect("error while running tauri application");
diff --git a/src-tauri/src/profiles.rs b/src-tauri/src/profiles.rs
new file mode 100644
index 0000000000000000000000000000000000000000..4dfab5f46a24150a8d7629c18b98c7598b59a7bd
--- /dev/null
+++ b/src-tauri/src/profiles.rs
@@ -0,0 +1,90 @@
+extern crate reqwest;
+
+use crate::config::verge::{ProfileData, ProfileUserInfo};
+use crate::init::{app_home_dir, read_verge_config, save_verge_config};
+use std::default::Default;
+use std::fs::File;
+use std::io::Write;
+use std::time::{SystemTime, UNIX_EPOCH};
+
+/// Todo: log
+/// Import the Profile from url
+/// save to the `verge.yaml` file
+pub async fn import_profile(profile_url: &str) -> Result<(), reqwest::Error> {
+  let resp = reqwest::get(profile_url).await?;
+  let header = resp.headers().clone();
+  let value = header
+    .get("Subscription-Userinfo")
+    .unwrap()
+    .to_str()
+    .unwrap();
+  let value: Vec<&str> = value.clone().split(';').collect();
+
+  let mut user_info = ProfileUserInfo::default();
+
+  for each in value.iter() {
+    let each = each.clone().trim();
+    if let Some(val) = each.strip_prefix("upload=") {
+      user_info.upload = val.parse().unwrap_or(0u64);
+      continue;
+    }
+    if let Some(val) = each.strip_prefix("download=") {
+      user_info.download = val.parse().unwrap_or(0u64);
+      continue;
+    }
+    if let Some(val) = each.strip_prefix("total=") {
+      user_info.total = val.parse().unwrap_or(0u64);
+      continue;
+    }
+    if let Some(val) = each.strip_prefix("expire=") {
+      user_info.expire = val.parse().unwrap_or(0u64);
+      continue;
+    }
+  }
+
+  // save file
+  let file_data = resp.text_with_charset("utf-8").await?;
+  let cur_time = SystemTime::now()
+    .duration_since(UNIX_EPOCH)
+    .unwrap()
+    .as_secs();
+  let file_name = format!("{}.yaml", cur_time);
+  let file_path = app_home_dir().join("profiles").join(&file_name);
+
+  File::create(file_path)
+    .unwrap()
+    .write(file_data.as_bytes())
+    .unwrap();
+
+  let mut verge = read_verge_config();
+
+  let mut profiles = if verge.profiles.is_some() {
+    verge.profiles.unwrap()
+  } else {
+    vec![]
+  };
+
+  let profile = ProfileData {
+    name: Some(file_name.clone()),
+    file: Some(file_name.clone()),
+    mode: Some(String::from("rule")),
+    url: Some(String::from(profile_url)),
+    selected: Some(vec![]),
+    user_info: Some(user_info),
+  };
+
+  let target_index = profiles
+    .iter()
+    .position(|x| x.name.is_some() && x.name.as_ref().unwrap().as_str() == file_name.as_str());
+
+  if target_index.is_none() {
+    profiles.push(profile)
+  } else {
+    profiles[target_index.unwrap()] = profile;
+  }
+
+  verge.profiles = Some(profiles);
+  save_verge_config(&verge);
+
+  Ok(())
+}